I don't think this is necessarily a consequence of overinflated egos. I consider myself an average to slightly above-average developer, yet my salary is consistently higher than my peers. It's higher because I'm willing to negotiate on my compensation. I don't concern myself with what I'm worth or what business value I produce. I simply try to maximize my pay
This quote from Mr Robot sums things up brilliantly: "Power/wealth belongs to the people that take it. Nothing to do with their hard work, strong ambitions, or rightful qualifications, no. The actual will to take is often the only thing that's necessary."