What is the flexibility of renting that people always talk about? You can't just walk away from a lease at any time.
In many cases, after a year's lease, if you ask nicely, you can go month-to-month with the landlord. It varies, but I've had success with this. Usually there's a 2-3 month notification time with that, but it can open up options. You won't know if you don't ask.
And, worst case, you're paying rent two places for a defined period of time. I've done this before - I moved for grad school as the place I was working was becoming intolerable (my stress levels were through the roof, and grad school was the best option). I was able to find someone to take over my lease, but they couldn't afford the full rent, so I chipped in a few hundred a month (which was seriously challenging for me at the time) until the end of my current lease.
There's also an aspect of "financial certainty" in renting. If the dryer (provided with my rental) fails, I call my landlord, it's a pain for a week while we work out details, and it gets fixed. It's part of my rent. Same for (as a non-inclusive list of examples) hot water heater failures, air conditioner failures, various other plumbing failures, leaking roofs, etc. Not. My. Problem.
On the flip side, if you have a house, you're responsible for the mortgage until you pay it off or sell it. Depending on where you live, it may be difficult to sell it, and if you move somewhere new, you're on the hook for an indefinite period of time.
But, even with year long leases, you can still move at the end of the lease. If you have a reason to move, just plan it around that, and you can get away, free and clear.