I moved cities about 5 times between 18 and 30. Each time I had a pretty easy time making new friends in the place where I found myself, and learning a bit about myself and what I'm looking for in friendships, what I have to offer in a friendship, and the types of people I get along best with.
By the time I sorta settled down in my 30's in one more new city, I had decades of building that actual skills of meeting new people, becoming good friends with the ones who got along with me, and then maintaining those friendships over time.
Now, in my 40's, even with kids, I still make friendships at work, in the neighborhood, through my kids' schools and activities, etc. Making the leap of "let's hang out outside of the context where we met" grows easier when you've done it a million times before. And the act of scheduling friend interactions on your personal calendar becomes second nature over time, as well.
All this is to say that it's a feedback loop, and you want to be in the virtuous cycle, not the vicious cycle. But if you are in the spiral, breaking out of it can pay dividends faster than you'd expect.