Is there a way to make a phone in which an attack like that is impossible?
From reading on line it looks like the newer SOCs, A7 and up, with the secure enclave are hardened against NAND mirroring attacks. The encrypted key is stored in the secure enclave which the chip will erase if it recieves to many incorrect PINs.
Even if you do desolder the SOC you can't directly copy the encrypted key like you can from the older SOCs that store the key in NAND.
In that case you would need an Apple signed firmware update to the SOC to disable the key erasure. Hence the request from the FBI.
That is serious pain in the ass on a phone which most people unlock quite often everyday but I guess if you are a terrorist or criminal it's well worth the effort.
Well that's why they added they added the fingerprint scanner. You can have a complex passcode but not have to use it daily.
Of course that means if you are arrested they can just put your finger on the scanner if the phone hasn't been rebooted, the battery hasn't died and it's been less than 48 hours since you unlocked it.
I'd say, the newest iPhones are pretty secure with reasonable trade offs between usability and security. The only real change I could see them make is to prevent any firmware updates without unlocking the phone and maybe using coatings on the chips to make desoldering more difficult.