"Defensive purposes" is one hell of a creative license. You know it when soldiers "need to go fight" on the other side of the world "for defensive purposes". Or when a random someone enters your home with a gun "for defensive purposes". When was the last time a US soldier was called to arms to defend their own country?
> can't any development environment be potentially used for ethically gray purposes?
Any development can and will probably eventually be used as such. But while Facebook's "gray area" is siphoning and monetizing users' data, the US military's "gray area" is invading countries and killing a whole lot of innocent people in the process. So many that they have to threaten everyone else in the world with deadly action if they even try to look too closely. That's one soft definition of gray.
Imagine the NSO Group claiming "software development gray area" to defend themselves. And with any military the moral/ethical objection will go far beyond that because no matter how the rules are followed, the main purpose of a military is to achieve things by threat or application of deadly violence. So a general objection to cooperating with the military complex will always have a solid foundation.