You can fix this in the latest working firefox version with `about:config > middlemouse.paste = false` (I found this by browsing through about:config, so I'm not sure if it's decumented anywhere), but I'm not sure if that still works in the enshittified versions.
(It doesn't prevent selected text from being middle-pasted into other applications, but all my other disrupted-by-paste applications explicitly don't support middle-click-to-paste (in several cases because I deliberately wrote them that way), so I haven't gotten around to fixing that part yet.)