The criteria for initiating an initial sync currently checks to see if no ops are in the oplog. This worked fine until we started adding ops as part of initial sync in order to fix index unique constraint violations.
If you were to crash after cloning dbs but before generating indexes, it would be possible to restart the node and have it go straight into SECONDARY without completing the index builds.
Instead, the criteria should be whether the node has a minValid set. minValid is not set until the very end of initial sync after everything has successfully completed.
As a sanity check, the node should fassert if it finds that minValid exists but there are no ops in the oplog, as this situation should be impossible.