It's easy on the Mac to have a custom or purpose-built keyboard layout that makes sense for the user or context. It's a little harder with X (mostly due to uncoöperative DEs) but still doable.
Self-reply for Kwpolska: Adding layouts to /usr/share/X11/xkb/symbols/ is straightforward (but is necessarily system-wide, and requires root), and I do that. However, for the popular desktop environments, it's like pulling teeth to have that layout treated as first-class with respect to switching and settings.
(On MacOS, putting a .layout file in ~/Library/Keyboard\ Layouts is enough.)
(On MacOS, putting a .layout file in ~/Library/Keyboard\ Layouts is enough.)