Scientific exploration and peacekeeping are tasks that have been handled by militaries, historically speaking. Also, it's a bit inaccurate to call these Starfleet's primary purpose over military responsibilities. If that were true, Starfleet would be able to neglect defense over scientific pursuits. And I guarantee, never are you going to see a situation where the Borg or the Dominion are barreling down and Starfleet's attitude is "not dealing with that today. Today we're exploring."
Regardless, the Argument about whether Starfleet is or is not a military is never going to be satisfactorily resolved, and this is not the thread to do so. The relevant facts to this discussion is that the novels have always acknowledged Starfleet is a military, so it should come as no surprise the Vanguard series, as a novel series is going to follow suit with all the other novels that came before or after. Likewise, the whole "Starfleet isn't military" thing didn't officially start until the 80s anyway as a means for Roddenberry to launch a smear campaign against Nick Meyer after he was removed from authority over the movies. TOS did very much depict Starfleet as a military to the point that Kirk even calls himself a soldier and humanity is referred to as a race of conquerors in The Conscience of the King. Again, since Vanguard is set in the TOS timeframe, it should not come as any surprise to see they are taking that particular interpretation of Starfleet and the Federation as originally laid out in TOS.