ok... lets say there is a max...
and you use that 3 million to invest in something just doubles overnight to 6 million...
what then?
Nothing happens overnight. You just can't make any more tax-deferred contributions to your retirement plan if it exceeds $3 million in value. So you take the money ($1,000 or $10,000 or whatever) that you would have contributed to your retirement plan as ordinary (taxable) income, and you do something else with it.
You can still save for retirement, but you just can't deposit it into one of those 401(k) or IRA accounts as a tax-deferred contribution.