Comments like this perpetuate the idea that it's somehow immoral to want to earn money. We spent all this time and energy learning a commercially valuable skill, which is going to make a pile of money for someone else. It would be foolish to undervalue that skill at the endpoint of the developer.
It's good to distinguish between people who want to make a decent amount of money in order to live comfortably from those that want to make as much as possible in order to compete with their peers and perhaps make up for some self-esteem or other issues. I think OP was referring to the latter while it sounds like you're referring to the former.
Seems pretty silly to think that anyone who wants to make more than enough money to live comfortably wants to do so only to compete with their peers or make up for self-esteem issues.
There are lots of alternatives to the cases you present.
In general, wanting to make as much money as you can get is not, per se, evil or immoral.
"Golddiggers" go work as quants on Wall St. People that want to work on startups generally dream of the big hit, but also want to be fully engaged with their job and create vital code. At least that was my motivation.