And of course prior to that, the British Navy (and before that the English Navy) were their nation's "uniformed armed forces." America and other nations also posessed uniformed armed forces before 1864 (first geneva convention). The UFP might have that convention frimly ingrained in the way they do things. Earth was one of the founding member of the Federation and Starfleet seem to to a large degree be based upon Human military procedures. Many of the real world people who created Star Trek were US military veterans, it only natural that their experience found their way in to the show, rank structure, custom and courtesies, and so forth. It maybe a bit telling that Starfleet uses the ranks of Commander and Lt. Commander, which pins the originals of Starfleet's rank structure to four Human Navies. Starfleet you might have notice doesn't use "Sub-Commander."