Sure, but that's why you need to give people raises in line with market rates if you don't want to experience high turnover. That goes for junior and more senior people.
Companies often don't want to give big raises as junior people transition into mid-level, then senior. So many companies have a standardized 2-8% pay raise scale, which results in developers being drastically underpaid as they gain experience. The silly part of that is that those same companies are gonna have to pay market rate to replace those skills when their employees leave, and they have to eat the additional recruiting costs, lost institutional knowledge, and ramp up time for a new employee. Penny-wise and pound-foolish as it were.
Here is the equation in my mind:
cost of junior dev added slowness + senior dev lost training time > recruiting cost for senior devs + lost institutional knowledge + ramp up time for new senior devs
A junior dev will often stay with an organization much much longer than what is probably good for them, especially if they are actively mentored and engaged.