I was just reading a theory that people have a need to project irrational godlike and demonic forces onto the world. When they have a religion, they project these things onto a supernatural realm, which helps to compartmentalize the projection away from the real world, thus allowing them to see the real world more clearly, without the projection. But when religion is downgraded and taken away, the projection, instead of being directed at a supernatural realm, is directed at the real world.
That is, religion may serve a containment purpose by insulating people's need for irrationality away from their perceptions of the real world. But when that containment and insulation is broken, the irrationality leaks out and distorts their perception of reality.
I don't know where the author got the theory, but I doubt it's original with him. He is Jules Monnerot writing in 1949. He was trying to explain why communists were so susceptible to rationalization, so he says, they don't have a religion, so all the rationalizing that people would normally do in a religion is instead done in their dealings with the real world.
I had thought something similar before in trying to understand Social Justice Warriors. They tend not to be religious in a traditional sense, but they treat their belief system like a secular religion. Without a traditional religion to absorb all of a person's irrational tendencies of thought into a supernatural realm, they go for a secular religion, and their irrational tendencies of thought then get applied to reality, which causes problems.
Humans may have an innate need for some kind of religion, which must be satisfied in one way or another. And it may be that certain types of religion that keep religious types of thought up and away from their thoughts about the real world lead to more "rational" decision making and behavior than other types of religion that mix up the religion with reality.
And I might also say that, when talking about a "religion," what is meant is a "totalizing" tendency, a tendency to assimilate all thought to a core "theory," which leads to rationalization of those parts of "reality" that do not fit the core theory. And so religion would be part of the human tendency toward "sense-making," which, when things cannot be made sense of because of a lack of complete information, leads to rationalizing "fill-ins" or "gods of the gaps."