How can I create a custom keyboard layout without future updates breaking it?

Looking around the internet for info on how to create a custom keyboard layout, it seems that the thing to do is to put the new keyboard mapping files in the /usr/share/X11/xkb/symbols folder and edit the /usr/share/X11/rules/base.lst and /usr/share/X11/rules/base.xml files to reference the new keyboard layouts. However, I’m worried that if I edit files that live under /usr/share then the package manager might break my configurations in a future update. Is this really the case?

According to Archwiki, there are ways to put the custom keyboard layouts somewhere in my home folder but I am getting the impression that if I do something along these lines I won’t be able to configure my keyboard layout via KDE (since it is used to looking at the configuration in /usr/share). Which would be unfortunate because I really like KDE’s keyboard layout switcher.

Summing up, how can I configure my custom keyboard layouts in a way that plays nice with both KDE and the package manager?

Just guessing, but maybe remove write permissions from those config files?
(Then of course backup in case this doesn’t work).

The above might work if a future update tries to over-write the file.
On the other hand, it wouldn’t prevent an update from possibly deleting and then writing a brand new file… To prevent that I guess you’d want to remove delete permissions but still grant delete to an account the update wouldn’t use…

TSU