The stock market is overvalued and risky but so is real estate. I'm sure there are still lots of better-than-nothing companies to invest in.
You want to put money into things that are going to be making money in the future. Real estate is one, but businesses are another.
In general I would much prefer to not deal with real estate, but it simply would mean a lot bigger risk of a few unpleasant decades at the end of life.
If that's what you care about, it would be wise to consider the impact on society as well. Society doesn't do well when resources are only accessible to a wealthy elite, and a stunted society will hurt your childrens' future. So maybe it's not such a good idea for real estate to be a scarce, rapidly appreciating asset, if it leads to unaffordable housing and economic desperation for the masses, political instability, etc.
I'm not saying don't invest in real estate, only that the political conditions that make real estate a good investment may be bad for society at large.