My only complaint is with the EN-international keyboard my company prefers - there is no way to reverse the tilde key position back to the same place next to 1 on the US keyboard. The OS knows what keyboard the laptop has and refuses to change it.
You can see how I did mine here if you're interested:
https://github.com/bruse/dotfiles/tree/main/macOS (I suspect com.local.KeyRemapping.plist is most interesting, but the key layout file is there too, with some comments on how it was generated).
I've created my own keyboard layout plus do some key remapping on my mac. Are you sure this won't work for tilde?
The tilde key exists in the key map here: https://developer.apple.com/library/archive/technotes/tn2450...
You can see how I did mine here if you're interested: https://github.com/bruse/dotfiles/tree/main/macOS (I suspect com.local.KeyRemapping.plist is most interesting, but the key layout file is there too, with some comments on how it was generated).