In that article a (now patched) vulnerability is described, in which a desktop program listens to HTTP requests from localhost. That server essentially trusts its input and it can be used to compromise the system.
All that is needed is a malicious web page with JavaScript that opens a HTTP POST to 127.0.0.1:63342 with some data.
So, why do browsers allow JavaScript of remote pages to connect to localhost? Local web servers are used for a lot of things (test servers, Jupyter noteboos etc.).
EDIT: When I was playing around, I got this error (No 'Access-Control-Allow-Origin' header is present on the requested resource). It looks like this should have prevented the attack in the blog post as well?