It's a reason I take self-published technical books more seriously than "major" publisher books; the incentives are better lined up. 20 years ago, you could make an argument that working with a publisher would get your book on shelves at brick and mortar stores. But it's 2022 and to a first approximation 0% of technical book readers shop at Barnes and Noble.
The other reason you can imagine someone writing a "major" publisher book is that they lead a project they want to generate attention for. An O'Reilly book about your web framework has the benefit of implicitly endorsing the framework as something mainstream. That's a valid reason to do it --- for the author. But the incentives aren't lined up well for the reader!