If your junior employees frequently job hop as soon as they have been trained up then your company is mismanaged. There are always personal reasons (I ended up immigrating to another country as I was coming into Senior-hood because my partner couldn't affordably immigrate into the US) but if it's a pattern then that pattern is owed to undercompensation and other failures of management.
In the 2000s it was seen as very fashionable to job hop frequently, but it was a biased impression that was assumed to be nationwide while it was only really common in SV with the hugely lucrative signing contracts folks like Google, Meta et. all were handing out.
What is the benefit (to the company) of paying to train a junior, which costs their wage, along with a significant proportion of a senior’s wage, if there is no long-term savings on the junior’s wages later on? This seems like a prisoner’s dilemma where every company counts on another to do the ‘apprenticeship’ training.