Real estate is not inherently riskier than stocks. Buying a stabilized multifamily unit in a nice area is, in fact, safer than buying an individual high deviation stock such as Tesla or speculation stocks.
The fact that real estate is leveraged actually does not make it any riskier than stocks imo, because the equity you see in stocks in the stock market are themselves already leveraged. What company out there doesn't use leverage?
The reason real estate can be more dangerous than stocks is that there are a lot more opportunities for you as the investor to make glaring mistakes. There is less hand-holding. When you invest in a company, a person with theoretically excellent pedigree is getting paid an exorbitant amount to make sure that the company is not overleveraged, that the company has liquidity, that the company is deploying its capital appropriately, and that its operations are running smoothly. You get to own all of these aspects as a real estate investor and you are thereby appropriately compensated for that additional risk.