When you join the military, either through conscription or of your own free will, their first job is to train you psychologically so that your beliefs are aligned with theirs.
Yup, and it is a temporary effect - that is why there is a graduated rank structure. As the mental conditioning (to put it charitably) wears off, you are further removed from danger and positions where immediate obedience to orders is necessary.