The “what else you could do with the money” argument is standard in finance/economics , in fact it’s the cornerstone of the famous Black-Scholes formula for pricing options which takes into account "risk-free" interest rate.
However, you're missing the point. People MUST live somewhere.
Their only alternative investment is with regard to their down payment for money saved, or the amount of money that is (mortgage - equivalent rent), which is usually negative!
The BULK (or entirety) of the money they spend on their mortgage is not money that would otherwise be available for alternative investment.
You're right that the bulk of the mortgage payments, especially towards the beginning, do not go towards building any capital, which makes the investment even less appealing.
All the cost calculations should be based off interest only. The principle repayment is a cashflow issue - and a signifcant one at that.