from what i know, religion in its earliest forms was just prayerl, devotion and sacrifice... it wasnt until people saw a need to have some sort of structure that the bad seeds started to come out.
You know the analogy, one bad apple spoils the bunch. These "people" realized there was a gold mine under "the foundation" of religion. people corrupted religion and turned something good, into a profit.
Thats my understanding from my religion and Philosophy classes. I'm open to different interpretations out there.