Kudos to you developer for suggestions

I regulary use H3 as my chapters...
There must be a tiny/ slight difference between the ones that are detected and those that are not. It may not be a printing (visible) character (thin space, something else)
on the next book that fails
just do a search for <h4 Find, find next until the end and see if you see it missing one that should have been caught
And are you sur that a couple are not getting nested (h4, followed by h5)
Maybe a bug got fixed (was missing h5's before)?