It's not broken because of greed, it works because of greed, or more accurately because people behave in a way that is in their own self interest.
Ah, the Big Lie of the post-Reagan age.
Greed is when you want more than what self-interest demands. Greed is excessive desire that exceeds what is reasonable, healthy or meaningful.
Many, if not most, of the rich are greedy. They want more than what is best for themselves; they don't understand that impoverishing others also harms them.
As Adam Smith figured out a long time ago, a viable economic system has to work despite the existence of greed. This is not in any way the same thing as rewarding or encouraging or worshipping greed, as lassiez-faire capitalists want to do. In fact the principal function of government in a market economy is to provide regulation that will restrain the destructive effects of greed on social structures (such as the market itself).
As you say, a market should work best for those who behave in their own self interest. Greed is by definition excessive and thus not in one's one self interest; it is a character flaw and not the virtue that greedy folk wish you to believe it is.