I don't know enough about 19th century British naval history to have an informed opinion one way or the other.
Well, to make it short, there was almost zero chance of a naval war against Britain, because the Royal Navy was so vastly superior to any rival. But the British Empire was spread around the world, so there were great numbers of cruisers and smaller vessels stationed around the globe. They carried out a wide variety of roles, from suppressing the slave trade to exploring rivers to mapping the Great Barrier Reef to transporting government officials. The US Navy was stationed similarly though of course on a much smaller scale, and its cruisers tasked with a wide variety of duties as I mentioned back in
post 49.
The point being, a military organization can do all sorts of things in peacetime that don't appear especially warlike. Whether defense is the "primary" purpose or not, the functions are shifted according to national priorities.
We know Starfleet's primary mission is exploration and contacting new life. This is a constant refrain from characters throughout all the shows and films, it's the core of most plots when you get down to it. Also:
"Space...the final frontier. These are the voyages of the Starship Enterprise. Its five year mission: to explore strange new worlds. To seek out new life, and new civilizations. To boldly go where no one has gone before."
Not "to defend the Federation from all threats, both foreign and domestic."
But that's only about one ship. And that ship was more often on routine duties more comparable to an old naval colonial cruiser than exploring. And was pulled off even those duties when a war started, and to participate in wargame exercises.
In one of Robert Heinlein's novels, in order to be a "sky marshal" you join the fleet and work your way up to admiral. Then quit. Then join the infantry and work you way up to general.
I believe what it said was one had to have commanded an infantry regiment as well as a navy capital ship. Either way, it sounds like it would only work with a much-increased lifespan!
Starfleet is both frontiersman, and cavalry. It chooses to identify with the frontiersman. Not the cavalry. Because then they aren't at the frontier, they are chasing behind it picking up.
Frontiersmen aren't representatives of governmental authority, but Starfleet clearly is, so I don't see the parallel.
But speaking of the cavalry, troops of the regular US Army administered, regulated and patrolled Yellowstone and Yosemite National Parks for almost 30 years starting in the 1880s, putting in place many environmental protection and conservation policies and standards that would later be carried on by the National Parks Service. Another example of a military organization performing not-so-military-seeming service.