It's not like people sat down and said "clearly we'll have infinite population and hence a pyramid like scheme for social support for the elderly is ideal".

It was more likely something like "for the foreseeable future we'll have population growth and therefore a pyramid like scheme is a good solution for now".

Ideally the scheme should have already started adapting to the changing population dynamics, but humans for the most part (unfortunately) tend to kick problems down the road.

Politicians don't tend to get rewarded for solving tomorrow's problem when their populace tend to me more interested in having more money to spend right now.

So here we are, living large today with little regard for the cost to our future.