2. "Treat people nicely" is about as effective a corporate policy as a law is forcing people to "be good and moral." A small company can effectively assert hiring control in hiring only people who "gel" with the people leading the company. A large company with a hiring quota of hundreds or thousands of people a quarter cannot. Ultimately, people are going to have personality conflicts with coworkers at large companies. You can either accept that as an inevitability and find a solution for it, or you can write off people finding (somewhat legitimate but still entirely foreseeable and unavoidable) excuses to move as BigCo management not treating their workers "nicely".
If that's what you're saying, it's a false dichotomy.
Cry me a river for the corporations, who cares what they want? It's always their agenda that wins these days anyway. That's the way the world is going.
Yes, one way, in theory, of doing that is by offloading training externalities to higher education. But that has its own tradeoffs, namely, the tendency of universities to adopt ivory-tower attitudes to education, the tendency of American higher education to inflate costs beyond any reasonable limit to afford facilities, services, and administration of dubious value to the education afforded the end consumer / student, and the tendency of universities to not educate with an eye to the skillsets which contemporary employers value.
Which is why the better way is to localize training efforts with the actors for whom it is most relevant. But corporate actors are not going to do "the right thing" in a vacuum, the law needs to empower them to do "the right thing", because typically "the right thing" will hurt any actor who does it in isolation but is bearable if all actors commit to doing it together. The easiest, safest, and most predictable way of making that happen is through law or regulation.
2. Treating 'nicely' is far from enough if another company is simply able to offer a better package. For example, are small/new tech companies not deserving of keeping their investments because they can't pay their devs as well as some large ones? Or if they can't match the prestige of other companies?
As I said in point #1, as long as the rate of defections/arrivals is about even, then your losses on one employee would be offset by your gains on others.
My answer to why companies should train people if they can just leave for another company is twofold:
1: It evens out. Sometimes people will leave company A, which trained them, and come to your company, and other times they you will train them and they will leave. As long as the relative rates are about even, it should be ok.
2: Any general training that would apply to all similar companies can just as easily be acquired on the job at any given company. So train the employees, and if you really don't want to lose your 'investment' then perhaps treat them nicely?
Why are we always so quick to cry a river for huge organizations that hold a disproportionate amount of power over individuals?