I think that religion appears when you can overcome your basic needs (like food) and serves as a guide for living for those that can't be fully concentrated and live up to their ideals, because without a strong spiritual guide people will fall into conformity.
"You wouldn't logically think so, but it happens doesn't it?"
Well it is a thing that mostly ruins religion, because turds always go "lol u lied zeus doesnt move winds etc" without ever realizing what is the purpose of religion. Now there is a question: what shall religion look like without ever having a chance to fall into the trap like this?
Your first point is on track, but in actuality as our species developed, strict organized religion served to create conformity and this provided selective advantages. Humans live with a brain that became so intelligent it could override basic instincts and needs like food, reproduction, or even survival. In a godless amoral universe(the real universe) there is inherently no value to anything. For me, reproduction is my sole motivation for wanting to protect my family, bloodline, and the culture that is best suited to my bloodline and inherently tied into it, but this is hardly true for the population at large. Rationality and sentience can only exist without finite
"foreground instincts"*(birds know how to fly even if they have their wings bound to their bodies until adult hood, fish just know to live in a school, spiders just know how to build a web). Rationality, human ingenuity implicitly requires humans to be able to deviate from convention in order to solve problems. We can't be smart and have ultimate foreground instincts at the same time. With an infinite number of different ways data can be interpreted with no absolute frame of reference, humans could think and experiment themselves out of existence. In micro terms, a tribe could never figure out what is "good" and "bad" if everyone had different morals utterly relative to themselves, and in a larger sense groups could immediately within several generations become very culturally diverse from each other, decreasing the level of affinity and potential for cooperation. Religion works by assigning arbitrary values in place of these instincts which do not exist. Christianity helped unite all of Europe into a larger cultural tradition of Christendom. Christendom started from Hellenized Jews and was in many ways Greco-Roman in its essential nature from the beginning**, and over time picked up more European Pagan traditions, serving to bridge the gap between very different subsects of European ethnic and cultural groups. I think the Greco-Roman heritage of the Church allowed for the positive aspects of Old Europe's culture to be amalgamated with Germanic, Baltic, Slavic and Celtic traditions contributing to cultural and ethnic unity on a larger scale which in actually may not have been possible otherwise. Christianity brought Europe together, and created the scholarly tradition among Europeans that eventually will lead to its Ultimate Demise at some point in the distant future.
Islam did the exact same with the tribes of Arabia and most of the rest of Semitic speaking world, and even helped for a while unify Arabia with Persian people when they are in many ways very antipathetic towards each other. All the great societies of the past built monuments of magnitude to their gods, priests or god kings. No religion in Egypt, no Pyramid, no Pharaohs, none of those wonderful achievements and advancements.
The second point you make is something I often ponder, as for as many benefits as Christianity gave to the West, it has done its share of destruction as well. I often wonder what the west would be like if we could go back to 70AD and massacre every Christian in the world. I think monotheism in the West has run its course and is now working to destroy what it built. I do not know how to answer what a non-shitty religion would look like, but I imagine it would be more like classical pre-Christian religions. Probably something Zoroastrianism. Some of the benefits of monotheism while providing many of the benefits of pre-Abrahamic faiths. Maybe something more like Germanic religion.
*there are a lot of competing ideas on how to discuss human instincts, if humans have instincts, what we have if we don't have instincts but I'll use a model I prefer ; Foreground and Background instincts. I am sure a smarter person who I haven't read yet at some point has developed a better way to define this.
**while it is true Buddhism and Eastern religious traditions had direct influence on Christianity, the early religion was basically an amalgam of various myths made more palatable for gentiles of Greek and Roman times.