Sure. Some of that's illegitimate, but some of it definitely isn't. Publishers do valuable things too. For example, writer John Scalzi here answers the question of why he doesn't self-publish:
(See under "Why are you sticking with traditional publishing!")
And I'll note that in addition to the obvious functions of editing, marketing, talent development, and vendor management, they also provide capital. One could say correctly that it's perfectly possible for software to all be sold by single individuals. But most software is produced by companies, quite a lot of whom take up-front investment.
https://whatever.scalzi.com/2015/05/25/about-that-deal/
(See under "Why are you sticking with traditional publishing!")
And I'll note that in addition to the obvious functions of editing, marketing, talent development, and vendor management, they also provide capital. One could say correctly that it's perfectly possible for software to all be sold by single individuals. But most software is produced by companies, quite a lot of whom take up-front investment.