The shuttle crew WAS part of the military while the military payloads were being deployed; they'd have been breaking quite a few laws if they weren't. That is, incidentally, one of the reasons why NASA has always kept a stock of inactive (not retired, not discharged) military personnel as part of its astronaut program: for legal reasons shuttle's military missions required the reactivation of the crew for the duration of the flight.As you said, they did those things on behalf of the US military, not as a part of the US military.
OTOH, it could just as easily be true that Starfleet takes part in combat on behalf of the Federation military without actually becoming part of it. That would put Scotty's comment into an interesting sort of perspective. Picture that same conversation taking place on the ISS with a pack of orbital bombardment missiles being offloaded from a cargo ship. "This is clearly a military mission. Is that what we are now? Because last time I checked, we were scientists."
That is, in fact, the entire premise of the movie. Marcus was envisioning a MILITARIZED Starfleet, one in which ships like the Vengeance would be the norm rather than the exception. It would be a massive paradigm shift away from everything Starfleet had ever been, away from all of its previous priorities, all its existence principles and values.Back to the latest movie,JJ Abrams' insistence to the contrary of the obvious has to do with the plot.Admiral Marcus' actions of making a secret vessel like the Vengeance are reprehensible if we consider Starfleet to be a humanitarian organization.If we take it as the military organization it is,then Admiral Marcus' actions are entirely justified.He's a commander of a military department looking at a large war hell have to fight.While his actions in setting up Kirk arent kosher,if we base Starfleet as a military the construction and use of the USS Vengeance is entirely justified: and the actions of the characters only serves as a vain act of self destruction.
Would Starfleet being the military justify the construction/use of the Vengeance? We don't know that Marcus followed the proper procedures for building and staffing the Vengeance (Scotty even remarks that the crew may be private contractors), and he certainly wasn't justified in using it to attack the Enterprise, kidnap Dr. Marcus, etc.
What's also telling is that Marcus only could have made that transformation happen in the event of a massive and devastating war with the Klingon Empire. Marcus himself believed that Starfleet wasn't a proper military, and was willing to do some rather crazy things in order to change that. If Starfleet was ALREADY a fully prepared combat force, then the construction of the Vengeance and the destruction of the Enterprise is impossible to justify.
Even more interesting is that Khan doesn't seem to think so either, since he mentions Marcus' "dream of a militarized Starfleet." Think what you will about Picard's moral pretenses, but I'm sure that Khan of all people knows a military when he sees one.