I realize my approach might seem a bit "nuclear" (removing all opening/closing/self-closing anchor tags in a document), but if you step through one at a time and make sure you don't delete an open tag but skip the close-tag (or vice-versa), it's not so bad. And it certainly leaves "link" stuff in the header alone.
Besides, I think we can all agree that the mass removal of <a> tags is fraught with peril to begin with. Even if you only focus on the seemingly innocuous ones with href attributes, that doesn't mean the "id"s of those anchors aren't the targets of nav elements in the ncx file, or spine/guide elements in the opf. In fact, that's
especially likely in the case of some of those chapter-header monstrosity structures you pointed out.
So with all that in mind ... it seemed like you were in a bit of the "Damn the torpedoes! ... I've got checkpoints set" frame of mind anyway.