If I tried to self-publish my first book it would have never happened. I feel like there's too much to figure out I'd spend a year yak shaving and never produce a book. O'Reilly helped me focus on writing and making the content good and they took care of the rest. Coordination with editors, reviewers, and actual printing I'm sure would have taken me months to figure out and with O'Reilly it was just weeks.
Marketing had some push just because it was an O'Reilly book. Podcasts picked it up and that is where the sponsors started to get interested. If it were a self-published book I doubt it would have carried the same authority and not had as much interest. WRT sponsors, I did no work to bring in the sponsors or organize contracts. I only had to review the foreword and then was sent an "congratulations" email from O'Reilly that the book was sponsored. I did a webinar for one of the sponsors for free but haven't done any other work. We also were lucky enough to have CNCF marketing sponsorship who sponsored some of the book signings at events.
I still think O'Reilly added a lot to the process. Most of the extra work I did (website, affiliate programs, ad campaigns etc.) were minor work and didn't drive any meaningful sales.
Let me know if you have other questions.