But what do you know about the clients? Who at Company B needs to be handled with kid gloves? Who likes it when you're pushy? How much can you negotiate with Company C on the timeline? What are the strengths of the other developers both in house and at other firms?
That's the stuff you can only learn by working in the industry. That's what makes an employee valuable. That's the real skills, the stuff you won't learn in school.
In a profession, learning things like clients' preferences can be vital to performing a job effectively, but it's overly reductionist to call them "the real skills", even if that might be true in, say, a sales position.
So what? I learned some stuff from the company I worked for and they get the financial benefit for my creations long after I'm gone (at least potentially). I call that even (actually I already consider this advantage: company. I'd like to be getting residuals like people other industries do). If you don't want me to leave then make it attractive enough for me that I can't do so rationally.
In my whole career I've always gotten my best salary increases by moving. If companies want to keep me around the way to do it is not with a modern form of slavery but rather by keeping me happy. If they have some stupid rule that says the max raise per year is 3% and I can get 8% somewhere else then fuck them.