Open Tweaks, "Keyboard & Mouse" tab, enable Emacs Input. Now you get Ctrl-W in text fields and other shortcuts from Emacs. Doesn't quite work in Firefox though, which has a lot of conflicting shortcuts.
I have done exactly that... except it doesn’t work in Firefox, as you mentioned. There Ctrl-w always closes tabs, except in pinned tabs when it jumps to another tab without closing.
It does work as expected in Chrom(e|ium) and most other apps.
In Chrome you can still close tabs with ctrl-w, you just have tab out of a text box first.
I’m aware of that but I don’t really like it. I’d much prefer the shorter movement of Ctrl-w.
It puts less stress on my right wrist, which suffers RSI a bit and is consistent with terminals on every (unix-like) OS.
On macOS I get this behaviour via Karabiner Elements; on Gnome I mostly get it via Tweaks. Except in Firefox, as mentioned, where I put up with ctrl-backspace and curse.
If I could just get terminal shortcuts like ctrl-w for delete word or Ctrl-m for return to work in Firefox text fields it would be perfect for me.