It's not that simple. Right now the interest portion of my mortgage, plus my property taxes, plus my HOA dues, not to mention maintenance and upkeep, is more than what I was paying in rent right before I bought my house. That money is "thrown away" in the same sense as rent is; only money going toward mortgage principal gives me something to show for it. It absolutely would have been more economical to rent than buy. But I
wanted to buy (see: your totally valid argument about having the freedom to do whatever I want to my home), and was lucky enough to be able to afford it, so I did it.
Sure, you can make the argument that I can hopefully expect some capital gains down the road if/when I sell the place. But that's not guaranteed (consider all the people underwater on their mortgages, for example, after the 2008 financial crisis; I wouldn't be at all surprised if something like that happens again during my lifetime), and it may well be that putting that money in the stock market would net me better returns over time.
But it really just depends on your local housing market. In some places it makes more financial sense to rent (rent < interest+taxes+upkeep), and in some places to buy (rent > interest+taxes+upkeep). And sometimes the financials aren't the #1 driver of the decision, anyway.