Make -reindex cope with out-of-order blocks

Remember out-of-order block headers along with their disk positions. This is likely the simplest and least-impact way to make -reindex work with headers first.
    
Based on top of #4468, only the last commit is mine.