### CI Link

https://gradle-enterprise.elastic.co/s/xe5tsxwd6ky64

### Repro line

./gradlew ':modules:reindex:internalClusterTest' --tests "org.elasticsearch.migration.SystemIndexMigrationIT.testSystemIndexMigrationCanBeInterruptedWithShutdown" -Dtests.seed=21ABF49FDF24F147 -Dtests.locale=ar-DZ -Dtests.timezone=Europe/Vatican -Druntime.java=17

### Does it reproduce?

No

### Applicable branches

8.0

### Failure history

Looks like the first time it has failed

### Failure excerpt

```
org.elasticsearch.migration.SystemIndexMigrationIT > testSystemIndexMigrationCanBeInterruptedWithShutdown FAILED
    java.lang.AssertionError: expected migration to fail due to restarting only data node
    Expected: <ERROR>
         but: was <NO_MIGRATION_NEEDED>
        at __randomizedtesting.SeedInfo.seed([21ABF49FDF24F147:5E92BED7875328A5]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.elasticsearch.migration.SystemIndexMigrationIT.lambda$testSystemIndexMigrationCanBeInterruptedWithShutdown$1(SystemIndexMigrationIT.java:119)
        at org.elasticsearch.test.ESTestCase.assertBusy(ESTestCase.java:1069)
        at org.elasticsearch.test.ESTestCase.assertBusy(ESTestCase.java:1042)
        at org.elasticsearch.migration.SystemIndexMigrationIT.testSystemIndexMigrationCanBeInterruptedWithShutdown(SystemIndexMigrationIT.java:110)
```
modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/SystemIndexMigrationIT.java
return false;
    }
    @Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        List<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
        plugins.add(TestPlugin.class);
        plugins.add(ReindexPlugin.class);
        return plugins;
    }
    public void testSystemIndexMigrationCanBeInterruptedWithShutdown() throws Exception {
        CyclicBarrier taskCreated = new CyclicBarrier(2);
        CyclicBarrier shutdownCompleted = new CyclicBarrier(2);
        AtomicBoolean hasBlocked = new AtomicBoolean();
        internalCluster().setBootstrapMasterNodeIndex(0);
        final String masterName = internalCluster().startMasterOnlyNode();
        final String masterAndDataNode = internalCluster().startNode();
        createSystemIndexForDescriptor(INTERNAL_MANAGED);
        final ClusterStateListener clusterStateListener = event -> {
            if (PersistentTasksCustomMetadata.getTaskWithId(event.state(), SYSTEM_INDEX_UPGRADE_TASK_NAME) != null
                && hasBlocked.compareAndSet(false, true)) {
                try {
                    logger.info("Task created");
                    taskCreated.await(10, TimeUnit.SECONDS); 
                    shutdownCompleted.await(10, TimeUnit.SECONDS); 
                } catch (InterruptedException | BrokenBarrierException | TimeoutException e) {
                    throw new AssertionError(e);
                }
            }
        };
        final ClusterService clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class);