Correct me if I’m wrong, but professional intelligence officers aren’t supposed to be loyal to the President: they’re supposed to be loyal to the country.
Of course, if you believe that the leader of a country is the personification of the country itself, then this sort of thing makes sense… on the other hand, these guys thought that they personified their country, too, and they didn’t turn out so well.
(from hereitype, who notes “what the fuck have we come to that I am now defending CIA agents…”)
There's also a line of constitutional law cases starting with Bivens that prevents political firings.