Owning a home isn't much of an investment if the jobs, people, or weather shift out from under you. You're then stuck selling your investment, likely at a loss, while also moving to where you can make a living
Yeah, that's the chance you take buying real estate. Try not to be bad at it?
I don't know what to tell you, I bought in a city where I've lived for 25 years and in the neighborhood for a bit over a decade, even that not for the first time. I'm not going to say it doesn't take luck and work.