The Royal Navy analogy is fine. But the purpose of contemporary militaries is not exploration. The whole problem here is about how individuals define a military, the goal or purpose of an archetypal Military, and whether Starfleet meets those criteria to the individual asking the question.
Modern militaries engage in considerable scientific and exploratory duties, as we have covered to death.