C.F. also university professors or school teachers who also get similar, tho more limited tenure.
Not saying there are no edge cases where the policy can be problematic, but when you are standing in judgement over people, its a lot easier to be impartial and a lot easier to reject bribes when you have that kind of security.