A type of debate is sometimes held between atheist skeptics, sometimes between skeptics and religious people (usually Christians), whether religion is good for humanity or not, whether it has done more bad ore more good for humanity, whether humanity would have been better without any religion.
In this discussion (especially when it's held among skeptics) the premise is that religious beliefs are false, incorrect and just fantasy. That's not the debate at hand. The debate is whether this fantasy has done more good or bad for humanity, and whether it has any redeeming qualities and if it would be better if it didn't exist at all.
In order to get a better perspective on this question, one has to remember that humans are a highly social species. We have survived and thrived for millions of years by forming groups, tribes and societies that cooperate and work together. It's very hard for humans to survive on their own, and our best chances of survival have always been to live and work together in moderately-sized groups and societies.
Such a society has a much higher chance of succeeding and thriving when all of its members cooperate and work together, agree with each other, and there's very minimal disagreement, in-fighting and schisms. It, thus, helps greatly if the members of the society share a common culture, customs, traditions, beliefs, opinions. It helps when there's an underlying unifying culture and belief system which the majority of people agree on, and thus minimizes the amount of in-fighting and schisms.
From an evolutionary perspective humans have a propensity to religious and quasi-religious beliefs, even when those beliefs are objectively and demonstrably false. This may well stem from an animistic instinct, ie. attributing sentience to unexplained natural phenomena. (The core reason for this is that if you assume that a phenomenon is caused by some kind of living being, such as a predatory animal, that will induce you to be careful and eg. flee, rather than investigate and possibly get killed by the predator.)
If unknown mysterious phenomena, such as wind, thunder, the source of rain, the nature of the Sun and so on and so forth are instinctively attributed to live sentient beings, perhaps some kind of supernatural beings, it's very natural and easy for this to be taken to its natural conclusion and attribute them to some kind of superior supernatural beings that are higher in power and abilities than humans themselves (after all, humans cannot create thunderstorms, rain, sunlight and so on).
And since people living in a primitive society very easily agree with each other (because fundamental disagreements are ultimately detrimental to the very survival of the society, meaning that societies with a high degree of disagreement and distrust got naturally selected out), it's very easy and natural for religion to arise in such societies.
And it may well be that such religions have been during the millions of years that humans have been able to communicate with each other, a driving force behind cooperation and camaraderie among the members of tribes and societies. It gives the people a common set of beliefs, customs and traditions. It gives them a sense of community and belonging. When everybody engages in the same rituals and customs, it joins people together and gives them a feeling of companionship, and a desire to work together and help each other.
So it may well be that, no matter how false religious beliefs may be, it has overall helped humanity survive and thrive, and that without religious beliefs humanity would not be even nearly as advanced, or even exist, today.
Of course religion has been used innumerable times for absolutely heinous atrocities. But what hasn't? Pretty much every single societal phenomenon, every single belief system, has been abused for atrocities, to oppress people, to destroy other people seen as "enemies".