I definitely agree to pay off loans first and with buying > renting if you stay put.
Homes however are awful investments for the vast majority of Americans. Outside of purchasing during a huge housing recession (no longer the case), few homes appreciate in value at the rate of 1/2 that of the stock market.
Selling a home loses 6%ish in realtor fees. Upkeep can be substantial. Calculate costs on new air conditioners, heaters, roof, carpet, refinishing hardwood, new appliances, etc. Trends of today are unlikely to be the same in 10-20 years. Expect updating the house to attract sellers. HOA dues and insurance. If you own a home, you have a bigger need for umbrella insurance.
The reason to buy is that you lose more money renting than if you bought a similar home.
This post comes from someone who bought a home in 2010 at an interest rate that is likely the lowest on this board. I've seen gains for sure, but I've made out much better putting excess cash in the stock market over buying a nicer home.