Suppose you've got an average, B-grade engineer who has been doing this job for 3 years. They should have all the technical knowledge tuned to do this job, connections to all the right people they need to work with, and all kinds of institutional memory about why everything is the way it is.
You let that person go, and bring in an objectively better, A-grade worker. It's going to take months to find that person, more months to train them, and still more time before they're fully operational the way the last employee was. And you still have risks, that they're really a C but they talked a good game in the interview. Or they're not going to be satisfied doing this job for long. Or they're not even going to take the offer when you make it.
And yet, in my experience the average company won't try very hard to keep people. They'll give them mediocre raises for far less than they'd be willing to hire someone into that position for, and do very little otherwise to try to keep them happy until they have one foot out the door. I don't get it, it doesn't make sense from the coldest and most calculating perspective I can give it, but with some notable exceptions it seems that's just how it works.