Pictured above are 1940s American schoolchildren saluting the flag. The resemblance to the Nazi salute is uncanny; but actually both are derived from the same ancient Roman gesture. The American version was called "the Bellamy Salute", named after Francis Bellamy, who wrote the Pledge of Allegiance as part of a Columbus Day flag-selling promotion for a magazine. Bellamy, a Baptist minister, was part of a movement to put flags in every school. The placement of flags and the pledge continue to this day, and you can draw whatever conclusions you like from the practice. But during WW2, Americans became uncomfortable with the similarity to the Nazi practice and President Franklin D. Roosevelt rewrote the code and replaced it with the hand-over-the-heart gesture that is common today.
Then there's the "under God" part in the wording of the pledge, which is a whole other kettle of crosses. But even leaving "God" out of it, the basic problem with the Pledge of Allegiance and other loyalty oaths is that democracies are founded on the principle that the government owes allegiance to the people, not the other way around.