This function runs subconsciously all day long. From talking to strangers to reaching out to a friend, the lonely mind is much more aware of negative outcomes, so your mind protects you by telling you things like „I don’t talk to strangers because I would annoy them“ or „I don’t reach out to that friend because he’s probably busy“. And that makes it much much harder for lonely people to maintain a healthy social life.
As for the fix, you can try to set the social event up in a way that has less room for perceived threat. Think of third places, regularly scheduled meetings, etc. Or you can work on the function itself (=your thinking patterns). If you look at research on loneliness interventions, working on this function is the most effective way to help individuals overcome persistent loneliness.
Now the sad thing is that people don’t like to hear that the most effective way to combat loneliness is to work on their own perceptions, which makes the sales pitch rather challenging.