This is not accurate. The social security (SSA) withholding is from only "earned income" not from interest, capital gains, etc. Those funds are maintained in a completely separate pool of funds, apart from general federal government revenue. That SSA fund is then invested in a special type of US treasury bill. The SSA benefits are then paid out of that fund, not the general federal government budget. However, the US federal government is on the hook when that SSA fund is not sufficient to meet outgoing payments.
So in reality the US system is quite similar to what @Mike Lister says below.