If an individual persists in holding beliefs that are severely out of touch with reality, we call it insanity. If a group persists in holding beliefs that are severely out of touch with reality, we call it a religion.
Some might take this to imply that religion is merely organized insanity. But even in highly secularised Western societies, deeply held religious belief is much more common than insanity. And religious belief is not associated with an inability to function in society in the same way that insanity is.
Another implication might be that members of a group are more susceptible to mutual deceptions than an individual is to his or her own self-deceptions. But the qualitative difference between religion and insanity suggests that there is something deeper going on here.
Humans are intrinsically social animals. The ability of the group to survive and prosper in a hostile environment far exceeds that of the individual. A group functions most effectively if it has something approaching a "group mind". In particular it requires a common group-held world-view. If individuals in the group have totally incompatible world-views, then it will be difficult for them to hold sensible conversations with each other.
It may seem ludicrous that it is preferable for an individual to believe a false proposition just because the social group that they belong to believes it to be true. But nothing in this world is certain. And the cost of being wrong is far greater in the case where you are wrong and the group is right than it is in the case where you are wrong and the group is wrong. Even if you are right, and the group is wrong, there is little you can do to benefit from that belief if the action required to benefit from it is a group action.
Of course in practice there are limits to this logic. Furthermore, the tendency to go along with the beliefs of the group varies from individual to individual, and is very likely to be genetically determined to some extent. Even in times and places far away from modern Western culture, there have probably always been some individuals who have determined to make up their own minds no matter what everyone else believed.
Given that the individual has reason to adhere to socially defined belief systems, it becomes possible for belief systems to evolve by natural selection. Consider this: a tribe holds certain beliefs. At some point an individual changes their mind on some aspect of this belief system. Some members of the tribe are swung over to the new belief system. A schism develops. The tribe divides into two sects. It becomes intolerable for the two sects to continue to live as one tribe, so they form two separate tribes. The two tribes are now in competition with each other. In as much as the changed belief affects ability to survive, the tribe with the better belief system will come to dominate, and in the long term will probably exterminate the other tribe, either directly by means of war, or indirectly by gaining control over more of the local resources needed to survive.
For the individual in the tribe at the time of such a schism, we can see that the decision as to what to believe equates precisely with the decision as to what social group to belong to.
These days, in our modern Western culture, we make use of more sophisticated means of determining the truth about the world around us. Science is a social system for determining belief, but it involves a different type of interaction between individuals with differing beliefs. One does not "belong" or "not belong" to science according to one's beliefs. Holders of different scientific "beliefs" (which we would normally describe as proponents of different theories) attempt to convince each other of the truth of their beliefs, under the assumption that there exist methods for reconciling differences which will lead to everyone eventually holding a common, and presumably more correct, set of beliefs.
But the equation of belief system with membership of social group persists as a feature of a human society adapted to pre-scientific times. And to some extent it continues to be adaptive, even in a more rational culture. After all, science still falls short of being able to answer many fundamental questions, such as "What should I do next?" and "What should people be allowed to do?" And it is not too clear if science can directly answer these questions. At most it can provide a better understanding of the methods by which we do answer them.
Some modern popular religions make assertions about supernatural events that are supposed to have occurred a long time ago. Ancient documents may witness the occurrence of these events. We are told that "They were there, and they could not have gotten away with making things up about stuff that happened at that time. If they had made things up, then they would have been refuted, and their fictions would have been ignored."
The reader can perhaps see that this line of reasoning treats belief purely as a consequence of rational thought, and ignores the role of belief as a social activity. To refute a group-held belief does not mean that the group changes their minds, rather it means that the refuter has ceased to belong to the group. Which necessarily limits the refuter's ability to have any further impact on the group's belief systems.
The persistence of a set of religious doctrines in a religious community does not prove the non-existence of any possible refutation of those doctrines. It is of course very difficult for us to have direct knowledge of the social environment of those religious communities – in many cases we only know them from their own writings (and even these writings may be transformed by the editing efforts of communities that have changed over time) But we can just as easily see it happening in modern religious groups.
If you are "invited" to attend ceremonies and meetings of some religious group, go along and study them. What do they believe? What are the dynamics of belief in the group? What happens when someone doubts something, or asks questions? Even sincere new entrants to a religion sometimes ask tricky questions, and at the very least they have to learn the group-sanctioned methods for avoiding or dealing with those questions. It may be something as simple as learning to read the group's canonical texts "prayerfully".
It is not just relationships between individuals and groups that are determined by belief systems. Relationships between different individuals are often influence by the relationships between the attitudes of those individuals. For example we are normally more attracted to other people who share at least some of our attitudes and beliefs.
Of course someone who believes exactly the same as us doesn't have anything useful to say to us, because we already know it. Even as there is a human tendency for us to associate with those who share our beliefs, there is another tendency to find those who differ from us by a moderate amount, and to reconcile one way or another the differences we have. This process can, at least some of the time, lead to progress towards the truth for all parties involved.
When discussions occur between people with very different beliefs, it is sometimes necessary to make a conscious effort to find a common starting point. Discussions where each assumes that the other believes something that they don't in fact believe will fail to effect any useful reconciliation of positions. Sometimes the "shared ground" is found to be so tiny that both parties realise that discussion of the issue is pointless, and they "agree to disagree".
Descartes the skeptic said "I think therefore I am." The less skeptical and more religiously inclined might prefer to say "I believe therefore I belong."