Even if we grant this is going to be a problem, it makes no sense for any individual company to do anything about it. Why take on the cost of training a junior when they can bail in a few years? This is especially true if you're not a big tech company, which puts you at risk of having your junior-turned-senior employees poached by big tech.
And most of my friends and colleagues would take a full remote role that pays half what big tech, 5 days in office pays. Add in an extra week of PTO and you have a great pitch to devs.
You can incentivize people to stay with things other than salary.
Salary plays a part of course, but there is a lot of other aspects that make staying at a job worthwhile.