It has a purpose: survival. Bigger groups have a better chance of surviving all kinds of adversities - and especially conflicts with
other groups. Once you have enough humans in an area that they start to compete for resources, being a part of the larger group suddenly becomes critical for survival. This makes for a very strong selection pressure for group size, and starts a scaling race. If you want your people to thrive, you need to scale up faster than your neighbors. People who didn't want to scale their group - perhaps saying to themselves things like "scale needs to have some purpose", or "we are not ants or weeds" - those people all got absorbed into or killed by groups that did care.
IANAHistorian, but my current understanding is that this is the leading hypothesis for the rise of agriculture, and demise of hunter-gatherer groups - settling down to farm the land was, overall, a big quality of life downgrade compared to hunting and gathering, but it also could easily accommodate continued growth of population, wealth and knowledge. In contrast, hunting and gathering lifestyle was a scaling dead end. As a result, agricultural societies were quickly able to overtake and outcompete hunter-gatherers - where by "outcompete", I mean chase away, kill, absorb or even just outbreed them.