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).

Thank you. I'll check as soon as I can. I remember having asked that in the Ask Different Stack Exchange forum, but I couldn't even find my question.