This is exactly why people look at me weird when I talk about the turnover in software jobs being from 2-5 years when they often pay pretty well.
I simply cannot understand why software developers aren't paid better if they dedicate part of their career to a company. The second a graduate has spent the necessary "two years experience" for other jobs they've handed in their notice and are looking towards much larger salaries. I've seen people jump from £18K to £28K after two years experience, with their original company offering only £21K for their dedication.
To answer the question, the best industry to work in is one where software is the primary business, because treating you well and keeping your skill set competitive is within their best interests. It's why the best jobs are always at software shops and large companies like Google, Microsoft, Facebook, etc.