Your competitor pays its employees based on each employee’s results.
Then let’s see which company survives in the market.
If you have an average employee who complains a lot and he may leave, but that would be a hassle for you, then it makes sense to pay him a bit more so he shuts up and you don’t have to look for a new person.
Otoh, if your underpaid star developer sits quietly in his corner and all you have to do is to pat him on the back once in a while to keep him happy, why would you pay him more?
This assumption doesn't always hold.
Employee and employer might agree to share the value created which is not always a function of time spent working.
Value sharing is a basic framework for compensation negotiation. Employee wants to get all the value derived from own contribution. Employer wants to pay absolute minimum employee is willing to accept. Paying more than derived value doesn't make economic sense, so compromise will be somewhere within this range. If acceptable minimum is below the derived value, compromise is impossible. Time spent working is a free variable in all this.
So you "should" pay for example Rob Pike or Ken Thompson equal to what you would pay some junior dev because they invest eight hours of their time each working day?
Not relevant to the topic, but this one is not true.
The cost of an item is often linked to how much was invested (because that is linked to how much it took to come to fruition, and therefore, how much it needs to sell at to recoup that investment). It's not only the 8 hours that is invested, it's the previous investment that needs to be recouped. That's one reason behind why different people cost different things, which is ultimately down to quality.
We're back to the initial question but at least we've dispensed with communism in the meantime.
To illustrate further, as a farmer, I sell grain, not time. The job requires my time to be inputted, yes, but if I put in eight hours of work or two hours of work to produce the same amount of grain, I am getting paid the same either way. Developers can structure themselves similarly, which is to say selling something that is the product of time, not time itself, if they so choose.
The average developer, especially those on the lower end of the pay scale, however, most commonly chooses to sell their time and their time alone. And when you are selling hours just like everyone else, price is going to converge within a relatively narrow range. An hour is an hour is an hour so it is difficult to differentiate if one hour is more valuable than another or how that hour translates into the output, and so it is priced accordingly.