Maybe the answer is to keep inventing better religions. The old ones keep appearing more and more ridiculous and pernicious. I suppose this trial and error produces lots of cults and casualties.
Or maybe the answer is for people to grow up and take personal responsibility and truthfully examine what we really know about life and stop trying to hide from reality. That's the path I personally have chosen. But I think the first might be easier on a mass scale. IDK.
And we clearly have a strong need for social belonging, most of us.
Spiritual experience is scientifically measurable brain activity. People enjoy it.
Having been wounded in this way, people seek any path out of their suffering.
Spiritual experience is observable in the brain, but it is certainly not understood, nor are the mechanisms. This is equally true of psychedelic experiences caused by drugs.
But that's the whole point: a lot of people simply cannot live with the ambiguity. For them, ambiguity means uncertainty, and uncertainty means fear and a lack of stability in general. Instead, they need to be told what to do and think and how to live their lives. They need some sort of compass, ideally one they share with a lot of others.
That is why religion has been so massively popular: some figures in the sky say, "this is how shit works and you can't question me/us about it" and that is sufficient for most people. They now have that area of their life handled and can comfortably think about other stuff. They can sleep well at night knowing that some omnipotent being is protecting them, and if shit goes wrong they have something they can attribute it to, like "we must have angered such and such omnipotent being."
Phrenology never played such an important role in people's lives, so its going away never created the type of vacuum that lack of religion creates for people.