When a people are out of control, unmanageable, and need structure, but have no established leaders, they need a leader, but that leader must have a basis for leadership. When all else fails, create a basis out of nothing -- one with mysterious, powerful control over them
If I were you, to avoid confusion I would rewrite this premise as "religion developed as a means of controlling society" or "religion's historical role in society has been in justifying the power of the ruling class", something along the lines of that.
Society is defined as a group of individuals who share a distinctive culture and institutions. Society was actually a byproduct of religion. Farming led to religion (as a means to appease the gods, who controlled the weather), religion led to culture, and culture led to society.