In my opinion, a lot of this could be in your head but a lot of it could be down to habitual things, like your hobbies. Having hobbies that are best served in an insular way can be quite corrosive to having a social life.
I have found this is true of me anyway...
Some of my hobbies have included learning and playing music, playing video games, and talking on forums like GAF / the bore. Spending time with a musical instrument can be a serious investment of your time. I still love music so I wouldn't really discourage it in anyone, but there are moments when you should choose time with other people over time with the piano/guitar. Back in the days of N64 and PlayStation, and arguably even the Wii days, you could play games with friends and still be largely social -- but a lot of gaming these days is done alone or online. To some extent - if you're serious about being more sociable, you might have to dial back how involved you are in that hobby. Similarly with forums, I had a near total mental breakdown a year or two ago, and coming out of it more recently I realised that I had been spending an inordinate amount of time (wasting time) by lurking and posting on forums. That shits good for shits and giggles when you're at work or bored, but there are real people out there, probably people who used to be your friends or who *could* be your friends. Since consciously curbing my own forum activity I've been more productive at work and more outgoing outside of it.
There is a mild form of bipolar-style depression called cyclothymia, characterised by periodic highs and lows. Symptomatically, it is not as evident as things like full blown depression or bipolar disorder, but you do experience entire periods where you are either content with your life or extremely saddened by it. When I first read about it, I wondered aloud to myself whether I may have had it. General bouts of depression caused me to go to the doctor anyway. Unfortunately, problems like this are incredibly hard for medical professionals to diagnose, and there's no magic survey to take. There is an extremely high probability they will fob you off by questioning your lifestyle and proposing diet or exercise changes as a result. That just seems to be their go to answer for things they can't really put a hard line on. Where there are other problems (for me it was work related stress and a failing relationship) they tell you that you have to consider those as factors as well. I stopped socialising, stopped caring about things I previously cared about, became extremely indifferent about other people, about my own health and appearance. Common thoughts I remember having included "what's the point?" and "fuck it I don't care". When it came to not being excited about things, I actually looked at people doing all kinds of travelling / adventure / partying with disdain -- like their enjoyment of life was superficial, false and forced. I basically felt like life was shit. I put on over 56 lbs in under 2 years... my lifestyle was then a symptom, not just a cause.
Initially I thought the answer might be to move back home, closer to family. Creature comforts. To some extent that did help, but eventually I came to the realisation that a lot of my old friends here have got insular lives of their own. Insular because they're now in long term relationships or married with children. I'm at that age (30) where that kind of thing is happening now. I eventually started to become conscious of the sense I could be lost or left behind if I didn't snap myself out of it and start doing more. I think it helped actually seeing people who were left behind like I described -- my line of work introduced me to a guy who basically lost all of his friends in his own peer group, and he was having to resort to hanging around with younger people. Of course, to them he's the old guy, so he's not really on their wavelength all the time, and it seems unlikely he'll find a future wife there or anything. He seems bitterly lonely and unhappy. It felt like a warning.
I do feel happier and more social now, and I think the first step of that was realising I needed to make a change - starting with any change. I used to think to myself that I'd like to see more of the UK, travel around in the car, give myself little breaks from the rat-race routine... But my brain was like 'you don't have the money', 'you don't have anyone to go with', 'it will suck'... One day I just said fuck it, got in the car on my own and started doing it. I have had a lot of fun meeting random new people in the last year or so, and when I couldn't be with friends, I've had my camera with me and started taking in the scenery and recording it. Green spaces. Water. Horizons. Recently I've taken up cycling again, and whereas the bicycle was simply an A-to-B tool for me before, its much more to me now. I enjoy the feeling of finding new routes and going further, or getting somewhere a little bit faster than before. The weight is starting to come off again (slowly). I'm seeing old friends. I'm putting people first, hobbies and bad habits second. For the first time in ages, I'm optimistic.
This might be nothing like what you are experiencing but I just wanted to share it in case any of it does sound familar...