Throughout your life, if you must, to "get on the records", work with a social security number that helps pay you during your retirement. It will help that you have something type of work ethic to be seen. If you have this much, you probably shouldn't worry too much about quitting your job if you wish. Don't let the worries of retirement prevent you from quitting. You'll either get another job with benefits, or your new company will open up a new 401k, while your old money sits in an account with the company.
After all, that 401k is associated with you, your social security number, your work, everything. Its opened in your account and can only be accessed by you. Social security was designed to help the older generation with pay as they grew older. in compensation with social security was meant to be a backup fund. So its generally like you're paying yourself twice, the 401k being the money you store for yourself and it gambles itself a bit or grows with other company assets, while the government is just taking your money in exchange to help you, with the promise that it will almost always certainly be there.
I hope my retirement generation of 2050 will not have to go in a "government borrow" where they increase the deficit by trillions, but that's the way the world works. Stop worrying about it. The government has been here for 250 years... they'll probably be here for a while longer, possibly as long as Rome was. They had a good 2,000 year run, leading up to the Great Empire, becoming the Great Empire, running the world as a Great Empire, falling like an Empire, and phasing out like an empire. Jews are one of the smallest Empires, yet are hardly phased out. When did the Romans know to quit? The Fall of the Roman Empire likely wasn't a quit, just too much corruption, and not enough focus on the ideals and goals. When the top gets corrupt, everything else will fall, again. It always has and always will. But during the time building up... everyone is loyal.
There are only so many years you can really dedicate as your best before they soon tell you that you cannot. There are only so many companies that will tolerate your age and your health. Give your best and do your best during your prime years. If, however, you have this feeling that quitting your job or knowing when to quit, once you've had enough... whether you are of age to retire or still have many years left... don't be unhappy. don't stay unhappy. do what you love and love what you do. even if it means walking away. though not always as easy as it seems when you are in your prime, and have children and a household to run.... much harder to quit. but you can only endure so many years of abuse by anyone or anything before the time clocks out for all of us and we've had enough.