Why do good coordinators leave but great coordinators stay?

How come after a team has a decent turnaround, like the 49ers and Lions did, their coordinators are itching to leave the franchise even in the middle of getting the job done, but great coordinators like the Chiefs offensive and defensive coordinators stay for many seasons?