The thing that would stop me from buying right now isn’t the price, it’s the interest rate. Also one method for dramatically reducing TCO of a house without increasing the monthly payments by that much is to finance with a shorter term loan. It’s harder to get rent to win when financing with a 15 year loan.
And it’s way harder to get rent to win without the opportunity cost, especially when comparing apples to apples on space. I feel like you’re mostly talking about what’s possible but not what’s likely. You might be able to come out ahead renting but I think most people won’t. Most people at the edge of buying a house aren’t going to invest if they decide to rent instead. The choice doesn’t seem to play out as buy vs rent+invest, but more often just buy vs rent. When the choice is buy vs rent, and renting isn’t offset by investing, then it really is pissing money away, transferring wealth away faster than if they bought a house.