I'd have gladly stayed at my third job for much longer than the ~21 months I did had there been training, retirement, reasonable pay increases, and career development offered. The same for my forth job. Some number of jobs later and my current one is also my longest tenure to date. Not coincidentally I have had and continue to have a clear path of career development, non-trivial pay increases and bonuses that aren't tiny. I've given up on employer-provided proper retirement plans and education/training.
"Firm hopping" exists, in my opinion, precisely because companies tend to either not recognize the role they must play in supporting long term tenures or else simply don't value them enough to allocate resources to the support.