Apple Answers Questions about Apple and security
apple.com
apple.com
I hope one day they can say "no, it's impossible", confidently and legally.
You are right about the government always finding a way to win, but this whole case sounds like the FBI messed up on handling the phone as evidence and is spinning the newsroom hard with the new drama with apple.
The reality is, despite apple's protests to the contrary, building the modified OS and giving it to the FBI would hurt their business a lot in both PR and savvy customers leaving.
It would have to 'get out' if it's installed on the phone. You are assuming the FBI (or other interested TLA agencies) lack the ability to extract the the compromised OS from the phone and/or retarget it to other devices. An even more nefarious scheme would be to modify the current code on the iPhone so that it logs Apples signing as they apply the update, but that edging into tinfoil territory