Of course rulers would use religion to their benefit, however I don't see that beinmg the reason for the creation of religion. Religion was used to explain man's surroundings, especially the sun, moon, and stars. It was believed these heavenly items ruled men's lives as they seemed to have controlled the seasons and nature. The same stars would appear at the same time each year "instructing" man as to when to plant and harvest. The stars also were used to guide traders at night, so knowledge about them became very secret. Stories were invented about the stars based on their location during the various seasons. These were also memory aids. These stories would become the major religions of Egypt, Babylon, Greece, Europe, and Persia, and most likely the rest of the world.
"On Earth as it is in Heaven, the Cosmic Roots of the Bible" available on the Amazon.