Can an iOS backup be compromised?

I originally posted this on the Apple Stack Exchange but it was suggested that it was off topic, so I’m posting it here in hopes that this is a more relevant place for it.

Say that an iOS device has been compromised by some vulnerability. If one were to backup their device to their computer (or iCloud, but it’s my understanding that making an encrypted backup to a computer allows for more to be stored in the backup, such as passwords) and then restore the OS using the backup to restore settings, could the backup re-compromise the device?

Secondly, have there been any documented cases of persistent threats (outside of jailbreaks) that are remotely exploitable and can persist after a restore?