You see in lots of classical and more recent Marxists and anarchists this idea that human communities (prior even to cities) were largely devoid of hierarchy. What's the consensus these days?
Can you more clearly specify what period of human history you're referring to? Which part of the world?
This is a very general response; I tried to include the most wide-reaching information I could! Hope it helps and I'd be glad to answer follow-ups!
For the most part, the short answer is yes, humans were pretty egalitarian before the birth of agriculture. In general, the pattern seems to be that hierarchies develop alongside a) population growth, and b) agriculture. Before the advent of agriculture, people were typically organized in loose bands of less than 100 people who worked together for food production, making hierarchy unnecessary. It wasn't until agriculture (and, as a result, a more clear and obvious division of labor in food production), that stratification really took off.
Agriculture was also important because it allowed for surplus to exist. It's a common misconception that hunter-gatherers were just scraping by; their existence wasn't necessarily more difficult than early farmers due to the intensity of that labor. However, they had no need to or way to accumulate surplus because of their dependency on their environment. With the birth of agriculture, people began to have more than they needed. This, then, plants the seeds (pun fully intended) for social power.