And what about all the other stuff that you get for free, including the majority of the content on the internet? What about all the other services like Gmail and the technical projects that have been opensourced? What about all the people who got rich and went on to invest in or start their own companies?
There's no "right" thing to work on. It's like asking why do we have astronauts in space [1] when there are problems here on earth. The truth is that it takes all kinds of people to make this world work and we're all better off if people get to do what they want to do, and hopefully it happens to be what they like doing too.
1. http://www.lettersofnote.com/2012/08/why-explore-space.html