All morality in a corporate setting is fake by design. Everybody simply maximizes their own bottom line, and if you don't too, you are an idiot. Training your own competition is simply not a way to maximize your revenue.
1) I don't think the premise is true, that everyone maximizes their bottom line figure.
2) Prisoner dilemma logic is suboptimal in the iterated prisoner's dilemma. Alliances are a thing in ongoing relationships.
3) Even if I were trying to maximize my individual value, training would still benefit me. Programmers with strong mentoring and management skills are more valuable to the corporations than programmers with just technical skills. Mentoring increases my value as a force multiplier faster than it increases any individual mentee's value.
Besides, training less experienced people is job expectation, exactly as writing unit tests and readabe code is job expectation. Nothing to do with morality.
It's part of why you (should) get paid more than them.
The real "dirty secret" is if you're not a team player, you're not a top performer because force multiplication through mentoring adds more value than the difference in your individual work.