They only keep their jobs through the administrations when they do as they are told. If the president wants to change a department's policy, and the department pushes back, he can fire as many directors as he needs to.
> The reason he can’t is simple: Unlike his employees at the Trump Organization, about a third of federal workers belong to unions. And those unions have negotiated certain job protections for workers, which includes a process that gives workers a chance to improve their job performance before they are terminated.
https://www.vox.com/2018/8/27/17786324/trump-fires-governmen...
> The reason he can’t is simple: Unlike his employees at the Trump Organization, about a third of federal workers belong to unions. And those unions have negotiated certain job protections for workers, which includes a process that gives workers a chance to improve their job performance before they are terminated.