Stocks are better for that in every way. If you buy a house you are dependent on political will to arbitrarily keep house prices high while for stocks the political incentives for growth are guaranteed to go in your favour.
It's a store of value, not an investment. The goal isn't to get rich. It's to not have to pay rent in retirement (yes, I know property taxes).