The test expects here that no checkpoint will be taken between the prior create collection and background validate cmd calls. However, there is nothing preventing the mongod from taking a checkpoint: it's a race.
I recommend converting the JS test into a unit test, where we can control whether and when checkpoints occur. We may or may not have added unit test coverage for this since the JS test was create. We should check validate_state_test.cpp and collection_validation_test.cpp to see whether we have coverage now – in which case we can just delete the JS test.