When an index is being built, we have observers that abort any ongoing migrations for the namespace where the index is being built. This is done to ensure index consistency across shards, because if the migration already started and passed the point where it copied the collection indexes, any new index creation would leave the cluster with inconsistent indexes.
Additionally, on an empty collection, an index build executes a single phase build, which only calls the onCreateIndex observer.
Joining those two facts, we can see how we are missing aborting migrations in the onCreateIndex observer, which might cause inconsistent indexes across shards when an index creation is executed concurrently with a migration to a shard that previously did not have collection data. The file attached: migration_abort_index_creation.js contains a repro where a migration that should've been aborted, succeeds.