Really the most likely explanation is that Apple writes security bug free code? My guess is the FBI found someone who knew how to exploit the phone or asked a 3rd party with connections to the NSA so there is a level of plausible deniability on the origins.