I've seen quite a few very lonely people turn to obscure cults, obscure philosophies, weird health communities, or smaller, sectarian movements within a bigger religious community. And from personal knowledge of some of these people, the underlying dynamic was always a kind of resentment towards and rejection of 'everyone else'.
One example that I found particularly painful to experience was a guy I met a few years ago. We got along well, but he had the extremely grating tendency to describe everyone as stupid ('sheeple'), unintelligent, inferior, etc. He was really taken with what I suppose you could call 'scientism' and gravitated towards the aspects of it that were mainly about belittling others. For example, he was a huge fan of some videos where Richard Dawkins would read semi-illiterate letters people had written to him, many of them religious obviously. All his colleagues were stupid too.
Over time I discovered that he'd had a shitty childhood (terrible family, school bullying), and this had just kind of continued on until his thirties. In the years he'd lived in our city he'd not made a single longer-term friend, and had never really had anything resembling a relationship. It seemed rather obvious that hating/rejecting the world because it never included him was more a defense-mechanism than anything.
What really hurt to see though, was that he was actually a pretty nice guy, he'd just never learned how to 'do' inter-human relationships! He was smart, funny, creative, sorta-caring and far from an 'inherent' asshole. He just truly never learned how friendship works. He never learned how to have a 'normal' conversation. And considering how much work and experience it takes to do social life right, it depressed me to think that he might never 'catch up'.
As an aside, I suspect this guy was on the autism spectrum. I think we often overlook how much effort, anxiety, and experience it takes for some people to even just pull off 'weirdo, but okay' socially.