South Africa has backed into the final of rugby’s Nations Championship despite losing to Ireland 20-17 in Dublin.