Another important aspect about retaining good employees is to help them through their failures. The longer an employee stays at a company, the more likely it is that they will screw up. No one has a 100% track record. Good management teams recognize this, and should have plans to guide faltering employees back on the right track.
Failures should be seen as opportunities for improvement, not as opportunities for blame. A good way to start is by having teams accept responsibility for failures, not a single employee.
For example, if someone accidentally deleted a production database and there's no backup, they didn't screw up, the team screwed up for not having backups and for encouraging working in production.