No, you're right about the death thing. That's how all life insurance works. They bet on the statistics that most people will die by Y, so the retirement age of X means they will make money if (Y-X) is positive. Pensions are basically just "rest of your life" insurance before the real life insuarance kicks in for your family.
And you see why they died out. Y-X consistently became negative as people lived longer, especially when we moved to a service industry. So they ended it and front-loaded the money. There's probably a lieu of tax codes and other benefit they get from matching 401ks as well that I do not know of without researching.