I live in a moderately small town (pop 100k) in West Europe, so developer meetups are right out. Never been very good at forming relationships with people either.
How do you fix this? Where do you meet people? It seems like whenever I casually talk to people, the whole thing just falls apart like a house of cards when they ask you what you do in your spare time or such. Why, yes, I work and I discuss work-related stuff with strangers on the Internet.
If you are a native to the town, then surely you know other people and have some "history". If not, then you can ask about things that you notice and share contrasts with where you originally came from.
When I go shopping, I talk with other shoppers. Chat with the shopkeeper. When taking a walk, I say hello to others. Comment on their dog if they are walking with one.
Yes, it does take effort, especially when you are introverted. But each little success provides incentive to try again. It is rather like debugging a program in a language you are learning. You try this, then that. Observing and understanding as you go.
Think of other people as microservices with undocumented API. You start with doing what has worked in the past and then experiment with new approaches.
Volunteering is a great way to gain that interaction around a shared goal.