For FF users: about:config - set signon.autofillForms to false.
uMatrix does prevent this as long as you keep the script blocked. But of course you're going to be out of luck if you have to allow scripts from the host that also hosts the script that exfiltrates the data. Sadly, there aren't really many sites left that function without at least partial JavaScript execution. Thus, as was mentioned in other comments already, disable auto pasting for your browser or possibly use a plug-in that disables it for you, as you can't really rely on uBlock, nor uMatrix, to reliably protect you against this.