Yep, that's the core of the problem. And the only solution is to start caring and making sure everyone does have something to lose. Ending poverty and discrimination would go a long way towards that, though there will always be mental health issues that are trickier to help people with.It's not very difficult for anyone to lose hope completely and conclude quite firmly that the world cares nothing for them (which is probably true). It's makes sense to me that you'd ask yourself "what do I have to lose"?
Religion isn't really all that relevant; people are people everywhere. There are plenty of nominally Christian white guys who go on killing sprees in the US, for example, and Buddhist terrorists in Myanmar. Terrorists of any background are often not at all devout. And they often either don't care about their families, or want revenge for what's already been done to their friends or families.
Absolutely agreed on inequality and consumerism. Spirituality is more problematic, since it tends to require believing in propositions of dubious veracity, and often comes with arbitrary and sometimes dangerous rules; I'd be reluctant to encourage more of it.Our society has aspects that drive people to disillusion; inequality (which I feel is on the increase) and an increasing void of any spirituality (which is entirely peoples' right) which consumerism is happy to fill.