### Elasticsearch Version

8.6.0, 8.7.0, 8.8.0, 8.9.0

### Installed Plugins

ESS default

### Java Version

ESS default

### OS Version

ESS default

### Problem Description

Our clusters hit continuously the following error on ESS

It is related to the number of shards per cluster `max_shards_in_cluster` that is calculated based on `max_shards_per_node` but is not correctly calculated, our value for `max_shards_per_node` is 10000. We have 10 data nodes, so we have configured more than 7000 shards per cluster for sure. No matter the value you put on `max_shards_per_node`, we cannot have more than 7000 shards in our clusters.

![image](https://github.com/elastic/elasticsearch/assets/5400788/b32b3025-6c49-4ea8-a793-3a3d8ff0d300)

```
      "shards_capacity" : {
        "status" : "Red",
        "symptom" : "Cluster is close to reaching the configured maximum number of shards for data nodes.",
        "details" : {
          "data" : {
            "max_shards_in_cluster" : 7000,
            "current_used_shards" : 9023
```

```
{
  "status": "green",
  "number_of_nodes": 10,
  "unassigned_shards": 0,
  "number_of_pending_tasks": 2,
  "number_of_in_flight_fetch": 0,
  "timed_out": false,
  "active_primary_shards": 5185,
  "task_max_waiting_in_queue_millis": 600,
  "cluster_name": "0000000000000000000000000",
  "relocating_shards": 0,
  "active_shards_percent_as_number": 100,
  "active_shards": 9753,
  "initializing_shards": 0,
  "number_of_data_nodes": 7,
  "delayed_unassigned_shards": 0
}
```

Probably related to https://github.com/elastic/elasticsearch/issues/91119

### Steps to Reproduce

* Deploy a cluster with Elastic Stack 8.7.0
* Create more than 7000 shards
* Change the value of `max_shards_per_node` to 5000
* Wait until the error appears again

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/node/Node.java
@SuppressWarnings("unchecked")
                        Class<Object> clazz = (Class<Object>) pcb.inter();
                        b.bind(clazz).toInstance(pcb.impl());
                    } else {
                        @SuppressWarnings("unchecked")
                        Class<Object> clazz = (Class<Object>) p.getClass();
                        b.bind(clazz).toInstance(p);
                    }
                });
                b.bind(PersistentTasksService.class).toInstance(persistentTasksService);
                b.bind(PersistentTasksClusterService.class).toInstance(persistentTasksClusterService);
                b.bind(PersistentTasksExecutorRegistry.class).toInstance(registry);
                b.bind(RepositoriesService.class).toInstance(repositoryService);
                b.bind(SnapshotsService.class).toInstance(snapshotsService);
                b.bind(SnapshotShardsService.class).toInstance(snapshotShardsService);
                b.bind(RestoreService.class).toInstance(restoreService);
                b.bind(RerouteService.class).toInstance(rerouteService);
                b.bind(ShardLimitValidator.class).toInstance(shardLimitValidator);
                b.bind(FsHealthService.class).toInstance(fsHealthService);
                b.bind(SystemIndices.class).toInstance(systemIndices);
                b.bind(PluginShutdownService.class).toInstance(pluginShutdownService);
                b.bind(ExecutorSelector.class).toInstance(executorSelector);
                b.bind(IndexSettingProviders.class).toInstance(indexSettingProviders);
                b.bind(DesiredNodesSettingsValidator.class).toInstance(desiredNodesSettingsValidator);
                b.bind(HealthService.class).toInstance(healthService);
                b.bind(MasterHistoryService.class).toInstance(masterHistoryService);
                b.bind(CoordinationDiagnosticsService.class).toInstance(coordinationDiagnosticsService);
                b.bind(HealthNodeTaskExecutor.class).toInstance(healthNodeTaskExecutor);
                b.bind(HealthMetadataService.class).toInstance(healthMetadataService);
                b.bind(LocalHealthMonitor.class).toInstance(localHealthMonitor);