I'm not an expert obviously and I could be wrong, but counterintuitively I think that getting out there and hopefully meeting people that you can be friends with can actually make you happy on your own. Things like self esteem and self efficacy are learned. You don't necessarily have to learn them from other people, but that can be a lot easier than getting it from some solitary philosophical meditation.
I used to be incredibly lonely and it was probably the main thing driving me to CTB, and it was having friends who saw the best in me that helped me get out of that mental state and made me healthy enough emotionally to eventually find my girlfriend who I've been with for a few days short of a year now. That combination of having people who were there for me at my worst and subsequently meeting someone who loved me more than I could initially understand drastically changed how I viewed myself. I would say that today, I generally like myself. I'm grateful to my past, miserable self and see him as someone who made the right decisions when they counted to eventually get me out of that hellhole, even if it was very painful in the moment.
Ironically, because I now have some people around me that I deeply care about, I'm happy on my own. The time I spend around others recontextualizes my alone time as an opportunity to unwind and do the things that are best done alone (i.e. personal projects and learning random things). Just as bullying and abuse often makes people internalise the destructive perceptions directed at them, having meaningful connections can help you like yourself and internalise that you're someone that is nice to be alone with.