I'm not going to go into too much detail, as I don't really have the time for an in depth explanation. But suffice it to say from a sociological perspective, organized religion formed along with more complex societies because complex societies need more rules to manage a higher population that came about because of agriculture and the rise of city states.
it's not a coincidence that hunter-gatherers worshipped fertility goddesses and totemic gods, and that actual "organized" pantheons came into being alongside the concept of "nations".
Organized religion was a tool that was invented to exert control and prevent chaos when societies were in their infancy and still figuring out how to live together and share resources. (ie. who are we and who are "others". Who gets to share our wealth and who doesn't, etc... etc...)
We don't need it anymore, and yet it sticks around causing all kinds of trouble.