Actually, I believe the armed forces of the UK actually take an oath of allegiance to the ruling monarch rather than to the state/government - I did think this didn't mean very much but I have raised the point with a serving army officer and he was rather insistent that they take it seriously:
https://en.wikipedia.org/wiki/Oath_of_Allegiance_(United_Kin...