indexbg_killop_apply_ops.js queries the index catalog on the secondary after RepSetTest.awaitReplication(). Due to the asynchronous nature of background index builds on secondary builds, this is not sufficient to ensure that the index has completed.
ReplSetTest.stopSet() has logic to wait for background indexes to complete and to detect if the collection on the secondary has different number of indexes from the primary:
The test assertions at the end of indexbg_killop_apply_ops.js are not necessary given the checks in ReplSetTest.stopSet().