Competition, where does it stem from?

No climactic climb today and I was a little disappointed when the dads group announced a longer yet flat route this morning. After miles up the beautiful scenic Canada road next to Crystal Reservoir and working on my power output with “sprints” to keep up with the men, I then realized how I have underestimated what I could learn from riding on gentle rolling hills.
As I occasionally passed some of the other cyclists, definitely noticed a pattern that I thought is quite interesting. The male cyclists that obviously looked like they would be much faster than I, shortly after I passed them and caught them off guard cuz they were prob just fixing their whatever, would immediately rush past me. 😅 I definitely did not imagine this. Even my brother in law and the other dads who slow down to keep me company for a little bit would all of a sudden speed ahead when we get overtaken by female cyclists.
So where does this little spark of competitiveness in all of us stem from? In this case, it feels healthy—a form of social facilitation that motivates us to dig deeper. I know I'm guilty of it too; I actually set a personal record on my last 5K simply by locking onto a guy who was setting a slightly more aggressive, yet achievable pace for me. But it makes you wonder: is this drive to chase down the person ahead of us truly innate, or is it a behavior we develop over time just to protect our egos?