Vulnerabilities CAN be avoided, including in software you write yourself, by reducing the attack surface introduced by dangerous, superfluous, given-by-default
https://en.wikipedia.org/wiki/Ambient_authority by insisting on the usage of operating systems, virtual machines and programming languages that use
https://en.wikipedia.org/wiki/Capability-based_security and allow programmers to apply the
https://en.wikipedia.org/wiki/Principle_of_least_privilege easily, correctly and on a, if desired, ever finer-grained level.
People figured this out 50 years ago but the rest of the world prefers to suffer I guess https://github.com/void4/notes/issues/41 https://en.wikipedia.org/wiki/E_(programming_language)