I think the other answers have mis-understood the OP's goal. He explicitly says that he wants to be a scientific programmer assisting other folks' research programs, not pursuing his own. Such positions do exist at every major research university. How common they are varies by subfield. In my experience physics departments generally leave all the programming to their students and post-docs, while life sciences department will hire quite a few software developers and data analysts, just as they hire a lot of wet-lab technicians. There is a lot of computational work to be done these days that requires fairly mature engineering skills, but is not novel research. Having your chemistry Ph.D. student set up a secure and robust web application is probably not a good use of their time.
To respond to the OPs question: what you want is not impossible, but you'll have to be lucky to pull it off. While there are scientific programmer positions at every major research university, there are not a lot of them compared to the non-academic world, and they generally don't pay nearly as well. I think PIs find hiring for these positions difficult and time-consuming, so they prefer folks looking for long term positions. Sometimes, one of the functions of these positions is to provide some overlap in institutional memory. Bit rot sets in rapidly each time a student graduates. If you aren't even going to stick around as long as your average Ph.D. student, your utility to the PI is diminished.
On the other hand, many of the grants that fund these positions are time limited. Projects that only last two to three years seem to be pretty common. That would seem to match pretty well with your goals. Unfortunately, at least in large departments, there seems to be a small cadre of programmers that get shuffled around projects as funding comes and goes. You'll be competing with those folks, and as they have a known local track record, it puts you at a disadvantage. For the same reason, constantly switching fields, would also put you at a disadvantage. Software skills are highly portable, but there is always some domain knowledge that's crucial as well.
I think your chances of success will be better if you stick to one field, say the life sciences. It will also help if, early on, you can find work on a high profile project, with a prominent PI.