The problem with jailbreaking is that it uses vulnerable exploits with good intentions… which means those same vulnerable exploits can also be used by unethical hackers to create viruses and malware. And if the jailbreak is public, the exploit, too, is public for the taking.
Apple should just remove the motivation for jailbreakers to seek out new exploits. They should give us the freedom to mod our systems and make and run homebrew code, and third-party apps that are otherwise banned from the app store (e.g. adult apps, 3rd party NFC cards, Fortnight).
This isn't unprecedented: Microsoft changed their security model on the Xbox Series S to reduce the number of hackers willing to find vulnerabilities in the system. They allow any Xbox Series S to switch from "retail mode" to "developer mode" at the user's whim. In developer mode, the user's can run unsigned code within the dev-mode sandbox, thus allowing homebrew apps to operate on an unhacked, unmodified Xbox Series S. This has removed the motivation for hackers to discover new exploits, and apparently, the Xbox Series S's security remains undefeated to this day, according to
this video.
I don't necessarily think Apple should copy the model Microsoft has used, but I do think they need to find a way that allows us to open their walled garden such that our systems remain secure from vulnerabilities. In this way, by making the jailbreaking community redundant, at least exploits won't be so easily available to unethical hackers.