Ok, then the other thing you're missing is that distributors also get a chunk of the ebook. You said ebooks have "no middlemen" but that's blatantly false, Amazon is the emperor of ebook middlemen. I suppose publishers could try selling ebooks directly but then they lose the Kindle platform + Amazon's reach, so Amazon charges for that service. They are a middleman.
The publishers conspired with Apple to force Amazon to increase its margins.
https://jolt.law.harvard.edu/digest/e-book-conspiracy-apples...
And in some sense the publisher is a middleman. While authors can sell directly, they rarely do. All of the books I have read had editors, publishers, etc. Not just the author writing and uploading.