True dat. But let's not forget that debugging is an art on its own – maybe even the discipline someone has to master to become a good developer ("everyone can code").
I guess book authors usually think "I'm teaching them to do it right, so why go into debugging – they just gotta not screw up". Unfortunately, it's not that easy. Everyone screws up, even the best of the best. That's why we need to have at least two people who had not been working on the task do a code review before it's merged to a production branch, why we write thousands of tests, why our code goes into E2E testing first and why we're running eight Jenkins.
However, there's something else that "hurts" me: Books for beginners almost never so much as mention (let alone teach) the art of writing clean code. One could argue that it's too much to ask of a beginner, but on the other hand learning this is much harder once all those lazy, dirty habits and patterns have settled in.
Even worse – most books even explicitly teach to write bad code by telling their reader to write a lot of comments etc. But that's another chapter.
Despite all that, people still manage to become great developers. I just think it could just be made easier for them.