Perhaps the allegiance to "the Flag" stems from the role that flags played in the Civil War. In the war a flag was the identifier of a regiment, Division, Corps, etc. And Medals of Honor were awared for the capture of a flag.