If Apple allows exceptions to the iOS sandbox for developers, it will very rapidly be abused by users who don’t understand the implications of what they’re doing.
You can see this in the many just-jailbreak-your-iphone-to-get-this-cool-feature videos all over youtube. Almost no-one outside of developers understands what it really means to disable these guardrails and the headache for Apple when it starts going wrong would be enormous.
Grandma: “I let my grandson borrow my phone but now it has this screen that says I need to pay money to decrypt my files how do I fix it?”
Apple store staff: “That appears to be malware, madam”
blank stare
Apple store staff: “I’m afraid there’s nothing we can do”
Grandma: “But the ad said it was secure.”
etc.