To chime in with my own anecdotal opinion that is likely to anger some people... in my experience most developers do their best work after about 6-8 months of starting a job at a new company, and that comes to an end after about 24-36 months of working at the same company. After that the vast majority of people just stagnate, get complacent, the job stops being interesting to them and they move on. After observing th…
You're not really making an independent measurement here. You see developers "stagnating" and moving on; how do you know that's not caused by lack of pay increases and other things you're doing (letting people pick new projects, for example, to keep them interested)? Maybe if you did "go out of your way to retain employees" you'd have employees who end up making your business even more successful during their longer…
The best cure for stagnation I've found is to take long breaks and get into something else.