Hi, I suggest changing the installation procedure of the keyboard layout for MacOS.
Looks like putting a custom keyboard layout in "~/Library/Keyboard Layouts" directory leads to issues with switching to this layout in many different applications.
The issue is resolved by putting the layout bundle in "/Library/Keyboard Layouts" directory.
There may be a better solution to the issue. However, this workaround worked for me and is recommended on Stackexchange and on Apple Discussions.
https://apple.stackexchange.com/questions/311615/can-only-use-custom-keyboard-layout-in-certain-apps
https://discussions.apple.com/thread/250820750