In most countries the backstop is to have a small defined-benefit state pension, so they won't end up literally penniless (in the U.S. this is Social Security, which pays a minimum of ~$9,500/yr). Other countries have tried to move more people into essentially buying annuities to mitigate the varying-lifespan risk. For example most defined-contribution private-sector pensions in Denmark now pay into pension funds (third-party, non-profit organizations) that by default are essentially the purchase of an annuity. You can cash it out as a lump sum upon retirement, but if you do nothing, the default is a traditional monthly pension for life, with the amount dependent on your contribution.
The reason pension obligations can be discharged in bankruptcy and 401k contributions can't+, is because the former is a contractual obligation to a future stream of payments, while the latter is a transfer of vested property.
Neither employers nor unions like this idea however because they both like to use pensions as a slush fund. Some workers also might not like it because annuities don't have great returns.
+There is the unlikely possibility of a clawback of 2 years at most.
In my view, there are 2 kinds of pensions. One is Defined Benefit, which is crazy to count on. On the other hand, companies can offer Defined Contribution, which is fine. If a company offers a 401K, and makes a 10K contribution, I'm happy. It's 10K more income that will probably get taxed at a lower bracket when I retire.