> If median income people will keep all their money in stocks
Median income people can't keep all their money in stocks consistently. At that level of income, they frequently need to draw against their savings (or more commonly can never allocate it all consistently into the market in the first place). That's a critical separation point between being at the median and being in the upper economic tiers: the need (or lack thereof) to tap your capital for major life expenses.
At a median income, step one is to have a cash buffer for emergencies. Just accumulating $5,000 in stray cash in your bank account as a life buffer is often difficult at a median income. Some emergency always wants to deplete it or otherwise move it backwards.
The reason median income persons can accumulate wealth in a house is because they require shelter. That ownership is often an expensive form of shelter and a mediocre form of investing (with a typical house property taxes will often wipe out between 1/2 and all of your home's value gain over time, if you're lucky enough to have any real value gain at all; throw in maintenance costs; then mortgage interest costs will smash another large share of your gains from actually paying down the mortgage; it's inevitably like burning a dollar but saving one corner of it and pretending it's a great form of wealth formation), however since they do require shelter regardless, it ends up acting as a very slow building form of wealth formation (via home equity).
You're at the median income. You've been careful and have accumulated $100,000 in the market. You require $50,000 of that for education expenses for your 15 year old child (you've known that all along and have expected to task a portion of that capital to that expense). 2008-2009 happens, the market tanks, it's the end of the world (according to the headlines). After the decline now you have $60k in the market and it's the year 2010. What do you do: pray it doesn't decline further or pull the capital and safeguard the required $50k? How confident are you vs your situation, circa 2010, that things are going to be ok with the market?
It's a simple example, however it perfectly illustrates why median income persons struggle to do what you're proposing. And that's a very conservative scenario that doesn't get into the countless other life emergencies that will come for you over eg 20 years of trying to build a consequential portfolio at a median income. It's not impossible, it's very difficult.