MachineScheduler: better book-keeping for asserts.

Fixes another test case under PR20057.