Prior to this change blocks could be pruned up to the last block before the blockfilterindex current best block.
This is a partial backport of core#21726, core#26215 and core#24410
https://github.com/bitcoin/bitcoin/pull/21726/commits/f08c9fb0c6a799e3cb75ca5f763a746471625beb
https://github.com/bitcoin/bitcoin/pull/26215/commits/8891949bdcb25093d3a6703ae8228c3c3687d3a4
https://github.com/bitcoin/bitcoin/pull/24410/commits/52b1939993771d0a8a718ca1667241872de8241a
Depends on D16096