I’ve noticed this, too! When I make a mistake, then the shock of realising it keeps it in my mind much more effectively than if I just read it in a list of “Ten Things Not To Do”.
And, even otherwise, there’ll always be small changes and optimisations I’m making as I go along — something which happens naturally, but wouldn’t happen if I just tried to memorise the instructions from what I read.
That said, I do think books are useful as well. As you mentioned, they’re fine as long as you don’t try to learn things by only reading books.