A country can get richer and still struggle to fund care, pensions and public services as its population ages.