Trump probably just takes it for granted that the military will support whoever is on the Republican ticket, because the evil Dems spend so much time talking about how military funding should be diverted to...you know...things that would actually help the citizens of this country (as opposed to being spent on murdering brown people overseas).
This is assuming, of course, that he puts any thought into it at all. And isn't simply reacting to anything he perceives as an attack on his fragile ego, regardless of the potential consequences. Even if those "attacks" come from members of the military.