Which rental apartment generates a 4% return on market value after interest and reserves? Rents would have to increase significantly for that.
Stocks and real estate are simply apples and oranges. Stocks have a low entry threshold, low transaction costs, and are very easy and cheap to diversify through index funds. Real estate (in the sense of direct investments, not funds), on the other hand, can easily be leveraged but also requires a certain leverage for the equity return to be reasonable. Diversification is difficult; correspondingly, a total loss is devastating. Transaction costs are high, but there are various tax advantages, starting with depreciation and extending to tax-free sale after 10 years. You can achieve a lot with personal effort, but on the other hand, you have the tenant hanging over you if the faucet drips or a corner in the bedroom molds.
Viewed soberly, real estate lives primarily from leverage and tax advantages, stocks from diversification and the possibility to start cheaply and without much equity.