I was wondering the same: I would be interested in an extension that tells me when a website try to connect to localhost (it should not be hard).
Then, once I know it, I would just react myself, as in the cited https://nullsweep.com/why-is-this-website-port-scanning-me/