You should consider why it is easy for developers to leave a company. It is also because companies hire only people who already know everything and don't train and give chance to people that might need to learn something on the job.
Also, if companies don't provide incentives for people who stay longer, it is only their fault.