Releasing the code (and thus methods) related to that strength would decrease some of those benefits.
I am not trying to comment on the validity of using military and intelligence gathering as tools in national benefit. I do, however, consider the US federal expenditures on military and intelligence gathering as a partial proxy for others' thoughts.
Maybe it'd be better to say that public money should produce public code by default and we'd put the onus on agencies and elected officials to exempt projects from the requirement.
Should the VA publish their record keeping software? Seems sensible. Should we publish the microcontroller code for ICBM guidance systems? I think the status quo of classifying that information is working out well enough.
No, but some stakeholders will see it as such.
Doing this efficiently, especially in software with its low replication costs, often means opening your systems for the world to use (fix, improve, buy), but even if not, considering the benefit of others as a detriment to you is almost never optimal -- SW engineering is not a zero sum game.