I am in a little bit disagreement with TG. I think it all depends on math. Life is fluid? That’s not a big problem. Waiting for variables in life to settle is kind of an illusion as if we can predict the future. One always needs a back-up plan nevertheless.
Currently, mortgage is less than half of rent in most places. So it makes sense to buy if you can afford not to sell in a few years. If one needs to move: fine, the contingency plan should be having a cash-neutral rental property in your name. If math doesn’t work (income too low or price too expensive), then rent.