If you’re using wayland, then you can create a layout in either /etc/xkb/symbols or ~/.config/xkb/symbols and it won’t be overridden by an update.
There’s also /usr/share/X11/xkb/symbols but you need to create a new layout instead of modifying an existing one. This will also work for X11 as would modifying /usr/share/X11/xkb/symbols/custom
AFAIK you still can’t select them in the GUI though, except for /usr/share/X11/xkb/symbols/custom as that’s what it’s there for.
Having said that, if this
is what you’re after, there seems to be an option to do it for you.
I don’t know what DE you’re using, but here’s how to activate it in KDE Plasma.
System Settings → Keyboard → Keyboard → Key Bindings (button on top right) → Compatibility Options → Map Scroll Lock to Mod3
Check the box and click apply.
If you use another DE it’ll be in the keyboard settings, probably under Options or some variation.
Or for any DE, you can use localectl to set both layouts and options.