The very best startup ideas tend to have three things in common: they're something the founders themselves want, that they themselves can build, and that few others realize are worth doing. Microsoft, Apple, Yahoo, Google, and Facebook all began this way.
-- Paul Graham in "How to Get Startup Ideas"
This is probably the most repeated and accepted startup advice -- it's now dogma that founders should only build things they themselves want.
I'd question the validity of the fact that all successful startups were built by founders who themselves wanted or were users of their products. Mark Zuckerberg, for example, wanted Wirehog for himself and enjoyed working on it and only reluctantly left it to work on Facebook. And that's because other people wanted Facebook.
Zuckerberg could do what he does best -- think about what Thefacebook should be and how it should evolve. Or, depending on his mood, devote his energies to something he wanted to use himself— Wirehog. Ironically, Zuckerberg was not a heavy user of Thefacebook. Nor, in fact, were any of its founders and early employees.
-- The Facebook Effect
As far as startup advice goes I think Peter Thiel's observation here is more useful:
Every moment in business happens only once. The next Bill Gates will not build an operating system. The next Larry Page or Sergey Brin won’t make a search engine. And the next Mark Zuckerberg won’t create a social network. If you are copying these guys, you aren’t learning from them.
-- Zero to One
Whether or not successful startups started from something the founders wanted, I'd like to argue that it's much better for everyone involved if programmers solved problems and built things for other people.
Argument from fun and success
One major insight I had as a kid learning programming was that programmers are like spell-stealers, we can learn someone else's superpower and then make the computer do it, sometimes even better than them! (Spell-stealing, if you don't know what it is, is an ability in fantasy games and movies where the hero can steal an ability or a power from other heros).
When I was 15 years old I built the first network gaming management system in Jordan. I did it by noticing a problem (that wasn't mine) and then observing and understanding what the cashier, the system administrator, and the accountant did. And I was able to automate away a lot of laborious work, cut the labor cost down and make handsome sum of money -- especially for a 15 year old.
Above all, it was very satisfying work. Understanding the existing system was arguably the hardest and most satisfying part of it. I'm usually hard on education but one thing I learned from my high-school computing course is that in order to "computerize" a system ("automate" for you youngins) you need to understand the system well-enough to propose changes (without introducing computers) that improve the efficiency of the system. Part reverse engineering, part learning something totally foreign to you from a perspective of someone that is not like you (design), and finally, part programming.
Running a network gaming store wasn't my problem but I was able to improve the businesses and efficiency of quite a few stores in Amman (not to count everyone that pirated my software).
Argument from social good
Living in Silicon Valley is like living in the future. My first Uber ride was in 2011 and just now, 8 years after it's introduction in San Francisco, it's become all the rage back home in Jordan. Solving our problems means that we'll continue to increase the gap between us and the rest of the world.
You can also look at this from an industry perspective. Just last year my doctor asked me to fax him something and I couldn't help it but let out a chuckle -- I've never had to use a fax machine before! But because not enough people have attempted to "computerize" the doctors they're still using old and inefficient technologies.
Regardless of religion or culture, it's perhaps universally accepted that if you have an abundance of something you have to be charitable and give some to other people. Yet here we are, with an abundance of technologies yet we insist on building more for ourselves.
Argument from competition
I've never seen as homogeneous a group of people as programmers, cross countries and cultures. If, for example, you reference an XKCD joke, chances are people will get it. Similarly, if you're thinking about a startup idea to solve a problem you have, chances are other programmers are thinking of the same idea. (Have you seen this week’s new continuous integration startup?)
However, if you go to an industry that is outside the purview of programmers, there are better chance that nobody is building anything for them and you can easily provide a lot of value and probably make a lot of money.
There are of course advantages to building things you want. My favorite is that the whole iteration-feedback cycle can happen in single programmer's mind, and most likely you'll find early adopter pretty easily. It's fun and it's always available to us (we always build tools and libraries). However, my aim is to encourage you to not be discouraged by startup dogma and go solve other people's problems!
Thanks to Christina Cacioppo for reviewing a draft of this.