Treat your employees well and they won't jump ship.

Its not about treating them well. The environment and culture isnt the problem. Its that tech companies have decided that they dont like giving appropriate raises to current employees. They are somehow fine with paying the same or more money to bring in an equally qualified external hire. But not with retaining people. Idk why, maybe some stupid MBA rule, mayne theres some good reason behind it

The problem is that (hypothetical) you as a line level manager don’t control comp and raises. Even in BigTech your manager doesn’t control your promotion and everyone knows it’s better to “boomerang” because you will get paid less being promoted to an L5 (mid) from an L4 than someone hired as an L5.