Not all programs misbehave in this way. Signal desktop lets you turn off this vulnerability, and of course iOS apps and normal macOS apps are not allowed to self-modify, as it breaks their signature.
https://github.com/signalapp/Signal-Desktop/issues/4578
https://github.com/syncthing/syncthing-macos/issues/122