Do licenses like the GPL even apply to TLA like the NSA and CIA? Or could they just make patches for themselves and not release them?
States are where you need to worry. Occasionally a state decides to pass a law[0] saying they can't be sued for certain copyright violations. Because of how the US constitution is set up, states (and nothing smaller than them) are allowed to just say they can't be sued, which lets them crime with impunity.
[0] https://www.npr.org/2020/03/24/820381016/in-blackbeard-pirat...
However I'm not aware of any case law proving this.