I DO NOT know if all our oaths of allegiance are the same, but magistrates are sworn to 'be faithful and bear true allegiance to Her Majesty, Queen Elizabeth II, her heirs and successors according to law'. The allegiance therefore is to the legal head of state. So if a properly conducted Parliament succeeded in creating a republic, the magistrates' sworn allegiance would transfer to the president when he or she took office. The present oath is therefore no obstacle in the path to a democratic republic.
R B Lake