Earlier quoted context omitted.
So that you don't accidentally run malware. MacOS is not iOS, you can run unsigned code if you really want to, but it will make you jump through a few hoops.
How is this better than trying to eliminate the problem between the keyboard and the computer? The user won't learn if the computer handholds them through everything.
It's like you are saying that potentially dangerous tools shouldn't have safety guards whenever possible, with little impact for the common use of the tool. Kinda absurd to think that way... If some advanced use-cases require safety guards to be removed that's when the user should be trained enough to know the risks.
People want to use a computer for their tasks, the whole motto of Apple was to make technology accessible to normal people without requiring them to be tech-savvy, what you want goes in complete opposition to that mission.