What should have been done was to make some precautions for the inevitable. There was always a good chance at the start of the various welfare states in the last century that people would live longer.
Why didn't they say "we'll pay pensions to the oldest X% of the population" or "we'll pay x% of GDP to the oldest people, according to living standards of the time"?
Instead we have societies where people feel entitled to be pensioned at a specific age. And it's very hard to change that age, while at the same time they become a larger and larger voting block.