It is if that invested money came from say, pouring metal in a foundry 60 hours a week for 40 years.
Hard work is replicable. Whether that's hard work pouring metal in a foundry, or writing code, or analysing the stock market and investing well, those can all be hard work. Hard work is not buying a lottery ticket, or a house in an area that gets gentrified decades later. Nor is it giving your wealth to someone else to invest on your behalf.
While a lot of people go the "buy a house" route, and make most of their investment gains from the house appreciating, others will put their money into e.g. the stock market and make their returns there.
Which part of this do you think "doesn't count" or has "nothing to do with hard work"?
If we were talking about only people who worked hard, put X% of each salary into the stock market, and ended up wealthy because their investments paid off, would that count as "getting rich from hard work"? Is your objecting specifically with the fact that their chosen investment was in a house?
Don't forget, buying a house is the same as putting money into a diversified stock portfolio in terms of work - they had to save X% of their salary to pay off a mortgage instead of putting it into the stock market, but effectually they worked the same amount and saved the same amount to end up at the same place. I don't think it's worth making a big point of difference over which exact vehicle they chose to put their investments in, as it obscures the point.
Note: I recommend the stock market instead of buying a house because, like parent says, investing in a house is more of a lottery.