Currently plan_cache_index_create.js starts with the creation of 2 baseline indexes using majority writeConcern and in the background. After creating we confirm that executing a find will generate a plan cache entry for the more optimal index. We run this test confirming both primary and secondary reads.
When reading from the secondary, the majority writeConcern background createIndexes invocation will confirm that the index build has completed on the primary and started on the secondary. It does not guarantee that it will be completed and available for a subsequent secondary read. We should change this specific index build to a foreground build which will ensure that we are blocked from reading on the secondary until the index build has completed.