It sounds as if, in your English instruction, you have been taught some set of inviolable rules related to the perfect tense. These rules might have helped you pass a class or learn the basics, but at some point you have to discard your book learning in favor of how native speakers actually talk.
Yours is a good example of how people often mix the tenses -- perhaps inelegant, yes, but nevertheless perfectly natural.
I had driven all the way to the store, and started to walk in, only to realize I left my wallet at home.
Here the use of the past perfect sets the time frame between the time I got to the store, and the time I began walking toward the store. I want to emphasize the events that happened in that moment, in a particular order, which can help the listener feel like they were there, or get them to sympathize with my predicament.
Yes, I could have said:
I drove to the store, and started to walk in ...
but this is just simple recitation of events. It doesn't have the same nuance.
(Edit) Turning this into reported speech changes very little:
He said he had driven all the way to the store, and started to walk in, only to realize he left his wallet at home.