That's not assured: phds are almost always paid significantly more and tend to be more involved in R&D projects than day-to-day code grinds, and depending on how short sighted the company is, R&D is often the first group to see cutbacks.
It's not all that uncommon for a company to simply look through their rosters and pick off the highest paid non-essential personnel (for certain values of "essential," which usually put middle management above R&D) to get rid of.
Of course this largely depends what kind of work you're doing, so YMMV.