Comment Look at Research Institutions (Score 1) 237
From reading your post, I saw myself a few years back. After working a couple of years in industry I quickly learned that I would rather apply my skills to more than just making some guy rich. Luckily, I managed to score at job at CSIRO (Australia's governamental research institution) as a developer - and it was awesome and fulfilling. After a few years I had the opportunity to move to Europe, and in wanting to stay within the research domain, I started a PhD at SAP.
From my experience so far I can say that, as mentioned, finding stable development work in research is very difficult - these institutions rely on external funding to operate and they have little control over that. But, if you are willing to deal with the uncertainty of 3 year contracts, it's totally doable - I would say try to find a position in a major institution so that even if funding dries up on one project, you can sell yourself into other projects.
Another thing that I would stress is think *very* carefully before taking the PhD route - this is NOT development work and the is so much in the periphery (working on unrelated projects, TA'ing, trying to get a hold of your professor, writing/presenting papers) which seriously departs from the simple pleasure of building something and making it work. Even in the case of someone who is passionate about research, has and loves a topic, PhDs make for a pretty miserable existence. Unless you want to become and academic, I would suggest sticking to the developer route.
Good luck!