The other part of why people leave is they end up doing lots of support. Often when things go seriously wrong or even just regular problems the main people called on to fix it are the people that have been there a while and know the system best. They end up missing out on the interesting new projects. Its a good incentive to move.
There's an unintuitive incentive to refrain from gaining too much knowledge of all of an org's systems. Being the support person across teams potentially lowers your value to your immediate leads since you get pulled away so much. Good management will identify and correct for this, but it's not easy.
My first full time boss quit over this. He was there 10 years and his life revolved around support as nobody else stayed more than a year, so nobody ever learned many of the systems.
some people like to be in this position, although I find those people have a way of stretching out every support or maintenance task that should take hours into weeks
That is more like after the long haulers have left and the new people have to figure it out. The guy who wrote it can probably fix in 5 minutes, the next guy is paid more but takes 5 days.