I normally wouldn't charge if it was blatantly my fault and I was just jerking around, but I'm not business-smart at all. I have found most business-smart people apply this philosophy that clients are paying for their time, and not merely an end result. There are many times in my career where, in retrospect, I regretted not thinking this way. All I thought about was end result as having worth, my time being meaningless unless it improved the end result. Yet one could be dragged around and have a lot of time wasted as a result of clients changing their mind, of co-workers causing bugs that get assigned to you and delaying your work, e.g., and not merely because you needed a little more research upfront to really know what you were doing.
When you start bending the rules and making exceptions to what sort of working time should be paid for and what should be free of charge, it can be easy to eventually get taken advantage of. Time is the easiest metric to use for payment. It frees you of a lot of complex liability, which might seem irresponsible, but it protects you from being being pulled around and having the client's irresponsibility lead to some pay cut.
In my case, it would be hopeless if I couldn't charge for going down the wrong path, as I often work on things like this:

... trying to beat a nearly 40-year old Catmull-Clark subdivision algorithm that has been entrenched in the industry and improved repeatedly by companies like Microsoft and Pixar by trying to provide more intuitive results while still being just as competitive as these huge companies speed-wise.
95% of the time in such cases, I'm going down the wrong route, constantly going back to the whiteboard after failure after failure after failure. If I couldn't charge for my failures, I'd be homeless already. I see more than half of my work as research, when no one has tried these things ever before, and there's no way I could just find the perfect approach to tackle a solution on the very first try (maybe 20th try). To me the goal has never been to succeed on the first try but to fail as soon as possible, with each failure after failure providing some clues as to what that correct solution, which might actually be capable of changing the world, might be.
Not everyone might be working in such an R&D-intensive area where the customers want and expect you to beat the most well-established techniques out there simply because you're starting a fresh project, but to me programming is never quite routine no matter how simple and established a solution is. How you design and integrate parts will still be unique, always some form of art in itself yielding unique pros and cons, not mechanical, not perfectly scientific, otherwise robots could do it. So I think inevitably we'll always have to charge for going down some wrong routes here and there, or else we would only be able profit from the most routine work that we've done a hundred times already for which we apply the exact same solution each time, in which case we would be charging for hitting the copy and paste button.
Unpredictability
Another thing is that programming is always hard, unpredictable, never quite routine. It's not like pizza delivery which is routine, where all but something like a car accident can be accounted for (I unfortunately worked under a boss one time who equated programmer estimates to pizza delivery estimates and thought the only work we were actually doing was typing). It's learning on the site, always -- I can't imagine it ever becoming fully routine unless someone actually repeatedly paid me to implement like a quicksort over and over. There's always going to be some experimentation and learning going on there, and as long as it's not excessive, no need to feel guilty about it.
I've often dreamed of becoming a farmer or something just so that I could find a lot more routine motions in my work, not always pushing the boundaries of my existing knowledge. Instead I try to compensate by making my life outside of work as routine and as mundane as possible, to add some predictability and routine motions somewhere for the sake of sanity, which makes me a bore among people who want to find excitement in their lives outside of work -- I find plenty enough at work.
He's talking about learning new things, not working on the wrong
solution.
Working on the wrong solution is learning new things, is it not? Did you know it was a wrong solution when you started, or did you keep persistently working on it even after you knew it was hopelessly wrong? Hopefully not the latter. Often the process of learning is through mistakes. It's the best teacher. The most effective strategy I've found is to just make mistakes as soon as possible, to discover that they are, indeed, design mistakes as soon as possible before we commit everything to them and marry such solutions, since the only constant I can count on and predict with near 100% certainty is that mistakes will be made. They're only expensive if they're discovered really late.