How about this algorithm ?
Whenever someone leaves, present two choices to the team:
1. Divide the salary of the person just left equally among the peers. For example, In the team of 5 developers, Joe was making 100k per year and he left the position. Give $25 raise to each developer in the team.
OR
2. Hire new person.
There should be a self-stabilizing compensation system where employee don't have to leave purely on the issue of low compensation.