I suspect that the cause is from bug 1897477 - whereas previously your script overrode the original command ctrl+f event callback, with this change both callbacks happen. So when findbar is already shown, your script will hide it, but then the original Firefox function shows it again.
You can probably change the last part to be like this instead (I don't really get what the middle part is supposed to do, but meh):
(function() {
document.getElementById("cmd_find").addEventListener("command",(ev) => {
ucjsToggleFindBar();
ev.stopPropagation();
}, { capture: true })
})();