Yes and no. I think there's an intangible benefit to homeownership that you can't get with owning other kinds of assets though. The knowledge that you fully own your home, a central need of human beings, can bring a lot of security and safety.
Plus, think of it like the money you pay into a mortgage is basically being spread out over your lifetime of rents. So while renting and investing (assuming your rent is less than your mortgage payment/you have a lot of equity now that you can invest if you sold) may be better while you're paying your mortgage. I would bet that those years once you have a paid-off mortgage would rapidly catch up with the extra cash-flow you have then. It's not just about asset valuation. Cash-flow is just as important, maybe even more important given we need that cash to survive.
But of course, I would always recommend a balanced approach. You wouldn't want your home to be 90% of your net worth of course, but if you can still have healthy investments while your home is 30-60% of your net worth, I think you're doing great and do not need to sell unless you really want to.
Other side being, if you want to be able to move to other places or need the flexibility of renting, then obviously selling and renting would make more sense.