Why bother publishing papers in journals?
There are a number of reasons to do so, never mind the existence of self-publishing on the internet. 

Some of the reasons are institutional. If you don't publish in reputable journals you probably don't have any future in most of academia. You will be judged, at least in part, and largely in some situations, on your journal/conference output. Some of this is just inertia, of course, but much of it is really valid. 

Your answer to another question on this site expressed skepticism of the review process. I think that view was too dim. People, even if unpaid, consider it their professional duty to contribute to the community by making a good faith effort in reviewing. Journals normally use several reviewers for a given paper so that the occasional poor job can be discarded. One person reviews papers so that other people will be willing to review their own papers fairly and honestly. The review process does two things. First it helps authors improve papers even if they are already pretty good. Second, it keeps junk papers out of the mainstream. 

So, authors and the community at large get a benefit from the publishing process that wouldn't be in place if everyone just self published. 

But there are other reasons as well, some of them going back to fair and independent review. In a world in which there were no gatekeepers on publishing (and there really aren't now - since you can publish on your own) every reader of every paper has to work hard to validate everything that is said. The effect of this varies by field. 

In mathematics it is fairly easy to write a paper that doesn't hold up, but "sounds good" due to the use of specialized mathematical symbols and terms (jargon). If I find a paper online, I have to work pretty hard to determine if it has value. If I find it in a good journal, I have some assurance that others, with skills like mine, have already done this and have found it worthy. So my task is eased and I can be more productive myself. Errors occur, of course, so mathematical skeptics are welcome. 

In some other fields, especially those relating to health and public policy, a lot of garbage gets published in the "popular" press. The anti-vax community, for example, has caused a lot of harm. Without the vetting process that occurs in reputable publishing, where people independent of the author have an important judgement, the garbage will start to obscure the gems. Enough of that happens already. 

And comments on self published work are just about worthless as a judgement. The reader of a bunch of comments has few ways to judge the veracity of the commenter. And bots and trolls are rampant in flooding the space with mis-information on some topics. 

A third issue is that if you only publish yourself, then it will be hard to find you. And even harder for people to make a judgement about whether what you say has value or not. An internet search on most topics will turn up a lot of things, of course, but it is, again difficult to sort the treasures from the trash. If I already know and respect some individual, then it is easy to find their work online. But not so easy to find the work of a recent PhD who doesn't yet have a body of respected work (probably in journals and conference proceedings). 

Publishing is a public good. It isn't paid for with public money, however. This is both good and bad. Having it be a private undertaking keeps the possibility of governmental interference (censorship) out of the game, but also requires that the money come from other sources: subscriptions, author fees, etc. 

So, publishing is an effective and sufficiently efficient (for now) way to make one's work known to a community who might need to see it and may use it to advance the state of the art. 

And, for most researchers the "high paywall" doesn't really exist. Many people use grant funds to obtain the materials they need, as well as to pay page fees required by some journals. But even a poor student can obtain free access to nearly everything just by going to a decent library and asking for a copy. You don't even need to go physically anymore. An email to the librarian may be enough if you are an enrolled student. The libraries pay the fees if needed, sometimes using public funds. This avenue may be open to nearly everyone, actually, provided that you have access to a library that, itself, has academic connections.