401k became a thing in part because of deep structural problems with employee pensions. Pensions don't "guarantee" anything in practice and many people lost them or had steep cuts. It is a promise, not a law of physics. 401k/IRA wasn't created for no reason. Pensions are exposed to much more idiosyncratic risk than a 401k and companies are poorly positioned to manage those risks.
Some people might not want to take responsibility for retirement savings in the same way they might not want to take responsibility for providing themselves housing but the alternative is strictly worse.
The only pensions that kind of work is government pensions because they can paper over the structural deficiencies with taxation. But even that has significant limitations as we've seen.
A 401k isn't required to be invested in the stock market. It is advisable but not required.
Defined benefit pensions schemes ultimately need heavy regulation and a government backstop otherwise failure is inevitable.
That said, they can work great in tandem with the stock market.
The Kensington & Chelsea local government pension scheme in London, here in the UK, is an example.
The local authority (not central government) ultimately has the responsibility on paying out these liabilities, but it's one of the few councils that just dumped their pot in to global equities, and as a result they are 200% funded relative to their commitments and have stopped making further contributions.
The money that was flowing into the pension scheme can now flow in to local services.
Asset allocations:
https://www.ft.com/content/87c321ab-e5ac-4a1d-a637-c1f7befcc...
Cutting contributions:
https://www.ft.com/content/67254bff-0e6c-407a-a24a-c34ee217d...