Sorry, but this overwhelmingly has not been my experience in nearly a decade working in tech. Even if you get 2-3 years out of a junior before they jump ship to a "big tech" (not as easy or common as you make it sound, by the way, especially during the last few years of layoffs and hiring freezes), you likely have reaped far more benefits at a low cost relative to the market than the ramp-up time investment in the junior. Furthermore, the talent pipeline here benefits everyone - even if they jump ship elsewhere, because you could not promote or otherwise mentor them into staying, you can also hire these "jump ship" engineers on the other side of the pipeline.
When this dries up because the market stops investing in junior engineers, you're left with absolutely nothing after a mere handful of years. I worry about this future a lot. Luckily I am in a shop that does not mind hiring them (now is a super good time to find junior talent at a good price too).