As the ways of the divine powers, or gods, are inscrutable to the masses of Men, a way had to be found to help Man understand them. This, perhaps, gave rise to that vast body of religious literature which constitutes rites and rituals to be observed to keep God, or the gods, happy.
Who could perform these rites and rituals better than those who conceived them in the first place? So, a class of men was created which had special powers to mediate with God on behalf of their bourgeois brethren.
As Humankind evolved, and his desires and desperation grew, the power of the mediators grew proportionately. They rose to exercise a special power over Man, who made his own mind subservient to the will of the Mediator, in lieu of his devotion to the Divine.
When Mediators differed, or when ordinary men aspired to be Mediators themselves, newer pathways to God were ‘revealed’.
Religions of the world are but pathways to God, Nirvana, to the Divine, to Realization or Moksha, or whatever is the name you want to call the Ultimate Reality.