There are two types of jobs.
One is where you learn as much as you can, trying to improve your skills. This is investment.
The other is where you use your built-up expertise to do a task as fast and as efficiently as possible. This is cashing out.
You need to be clear what it is you’re dealing with when faced with a job opportunity.
For example, startups will often market positions that might have a low tangible compensation, but offers tons of learning.
Big corporate setups will try and entice you with large compensation packages but it will often be work that you’ve seen or done a million times before (and they pay you for that kind of expertise).
You’d want to make sure you know what you want, and choose accordingly.
This works both ways too; if you’re a startup that pays peanuts (relatively), you should expect that the people you attract (who are willing to work for the compensation package you offer) are there not for the money, but for the learning.
Make their investment worthwhile, and you’ll keep them longer. At least until the time they want to cash out their investments in their skills.
At this point, you now have the choice of letting them go cash out at another organization, or let them cash out at yours by promoting them to a more central role, giving them more responsibility, and generally giving them the same work they have done many times before (because they are the most efficient at it).
Or you can offer them another investment role, with the caveat that they won’t be compensated as much for it (but the learnings will make up).
As long as both parties have clear expectations, then the work relationship can continue for a long time.