About the Source of Pension Funds:
Where exactly does pension money come from? The model in Europe and the United States is drawn from three sources: individuals, the government, and corporations. However, essentially, all of them stem from individuals because government funds originate from taxes and corporate money is derived from the surplus value of labor.
About How the Pension System Initially Got Passed:
Before and after World War II, pensions were born in Europe and the United States, respectively, as benefits fought for by the working class. However, from the perspective of the government, the best solution to worker demonstrations is the one with the lowest cost. Given that most strikers were middle-aged or older - the direct beneficiaries of the pension system - it's natural that they would strongly support such policy. They were the decision-makers in this conversation (younger people weren't as idle), and since they didn't contribute funds when they were young, they were pure beneficiaries, with over four younger people on average supporting one old.
Furthermore, for the Hoover administration at the time, this strategy was ideal for securing the votes of the elderly population. After all, the cost of improving welfare for the elderly fell on the younger generations. When the younger generations could no longer afford to pay, the government would issue more national debt, shifting the burden onto those who hadn't even been born yet.
Even if the younger generations saw through this, there was little they could do. In democratic countries, the voices of younger people are far quieter than those of middle-aged and older people.
Consequently, the government successfully shifted the original conflict between workers and itself to the workers of different age groups.
In summary: The pension system is the result of collusion between the government and capitalism. However, considering that a person's life lasts only a few decades, the selfish nature of the majority of adults leads them to choose actions that are most beneficial to their own group.