Some time ago I played around with some custom keyboard layouts for Ukrainian and I don't remember in much detail what I did, but as a result I started to experience this weird bug.
I downloaded a custom layout and installed it. I did not like it much, so tried to edit it with Ukelele and used it for some time.
Now it's long gone from my machine, but I still experience a weird bug, which first appeared at that time. macOS constantly adds a couple of 'Ukrainian - Legacy' input sources.
Even if I try to remove them, they will appear the next time I open preferences or reload the laptop. Behavior isn't very consistent though. After I delete them, they're gone from status bar and touch bar (but will be present in the preferences after close-reopen) until restart or log out.
I checked ~/Library/Preferences/com.apple.HIToolbox.plist and it seems to be correct and have only two keyboard input sources I added (US and Slovak)
How should I debug this?
UPD: I just installed my custom keyboard I mentioned on start of text and it behaves exactly the same as Ukrainian - Legacy (but thanks god macOS adds it only once, not three times)