GetBlockScriptFlags Does check the flag based on current block when connecting a new block, but does so on the tip of the chain when validating transaction to be included in the mempool.
GetBlockScriptFlags needs to be rewritten so that the code connecting blocks do accept an index to the previous block and not the one being connected. Various checks in the functions needs to be adapted in consequences.