Social security is a savings plan. You don't get social security if you don't work, and it's in proportion to how much you earn. This is, in fact, the point of social security. It came about as a response to old people dying in the streets. It exists for people who either through bad luck or lack of financial education couldn't save enough.
The idea is that if you worked through your life, then shit hits the fan, you shouldn't be knocked down below your contribution to society as measured by your level of success under capitalism.