Help me understand. Why would anyone want to work if they're going to have the same compensation as someone who doesn't work?
You are correct, that an equal salary leads to little work. Your imagined example of a fully equal salary scale leads to far less motivation to really produce. Why work if it won't raise your standard of living? That is a bad thing for you and for society. We need unequal salaries to encourage work and especially good work.
But, far too many people ignore the opposite problem. Image the opposite where it is a very unequal society (where a few people get everything and the rest of us are in poverty). Too much inequality means that no matter how hard you work, someone else will get the bulk of the rewards (Bill Gates or Warren Buffet or the Koch brothers). That too is bad for you and for society. Why work hard if you won't benefit and Bill Gates gets all the extra profit?
Thus there is a balance where working more or working harder gets you more. This encourages those who are motivated by money to work as hard as possible. Where is that balance? I don't think there is an exact answer. But almost all golden ages (including some of the best times of our society) tend to be somewhat near 10:1 (on average, there is no hard limit). Work hard (or even just be lucky) and you can get 10 times more than the lazy bums (or the unlucky). That gives a strong incentive to work more.
Above 10:1 you start to get diminishing returns. 20:1 may work quite well too, but 100:1 (close to where we are now) starts to get some strongly simmering class issues.