Buying a house I'd argue is freeing. Yes you can't move next year, but in about 5 or so you'll have equity (baring any major market downturns) and can always sell. These days a lot of lenders will even allow you to pause payments and take it out of the sale proceeds.
Better than dumping cash into nothingness.
Plus if you absolutely have to due to lack of equity you can rent it out for a time before selling or maybe even moving back.
Owning a home is less flexible, but still the better move financially