**Build scan:**
https://gradle-enterprise.elastic.co/s/nmjznurkclizw/tests/:x-pack:plugin:security:internalClusterTest/org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests/testConcurrentCreationOfNewProfiles

**Reproduction line:**
`./gradlew ':x-pack:plugin:security:internalClusterTest' --tests "org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests.testConcurrentCreationOfNewProfiles" -Dtests.seed=DF7A58E7374EF2C7 -Dtests.locale=id-ID -Dtests.timezone=Europe/Ljubljana -Druntime.java=17`

**Applicable branches:**
master

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests&tests.test=testConcurrentCreationOfNewProfiles

**Failure excerpt:**
```
com.carrotsearch.randomizedtesting.UncaughtExceptionError: Captured an uncaught exception in thread: Thread[id=339, name=Thread-17, state=RUNNABLE, group=TGRP-ProfileDomainIntegTests]


  Caused by: java.lang.AssertionError: caught error when creating new profile: org.elasticsearch.action.UnavailableShardsException: at least one primary shard for the index [.security-profile-8] is unavailable

    at __randomizedtesting.SeedInfo.seed([DF7A58E7374EF2C7]:0)
    at org.junit.Assert.fail(Assert.java:88)
    at org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests.lambda$testConcurrentCreationOfNewProfiles$0(ProfileDomainIntegTests.java:321)
    at java.lang.Thread.run(Thread.java:833)

```
x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/profile/ProfileDomainIntegTests.java
if (readyLatch.await(20, TimeUnit.SECONDS)) {
            startLatch.countDown();
            for (Thread thread : threads) {
                thread.join();
            }
            
            assertThat(allUids, hasSize(1));
            final String uid = allUids.iterator().next();
            if (existingCollision) {
                assertThat(uid, endsWith("_1"));
                assertThat(uid.substring(0, uid.length() - 2), equalTo(existingUid.substring(0, existingUid.length() - 2)));
            } else {
                assertThat(uid, endsWith("_0"));
            }
            final Profile profile1 = getProfile(uid, Set.of());
            assertThat(profile1.uid(), equalTo(uid));
            assertThat(profile1.user().username(), equalTo(username));
        } else {
            fail("Not all threads are ready after waiting");
        }
    }
    public void testDifferentiator() {
        String lastUid = null;
        final int differentiatorLimit = 10;
        final int otherRacUserIndex = randomIntBetween(0, differentiatorLimit - 1);
        for (int i = 0; i < differentiatorLimit; i++) {
            String currentUid = doActivateProfile(RAC_USER_NAME, TEST_PASSWORD_SECURE_STRING).uid();
            assertThat(currentUid, endsWith("_" + i));
            if (lastUid != null) {