### 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
b.bind(NamedXContentRegistry.class).toInstance(xContentRegistry);
                b.bind(PluginsService.class).toInstance(pluginsService);
                b.bind(Client.class).toInstance(client);
                b.bind(NodeClient.class).toInstance(client);
                b.bind(Environment.class).toInstance(this.environment);
                b.bind(ThreadPool.class).toInstance(threadPool);
                b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
                b.bind(ResourceWatcherService.class).toInstance(resourceWatcherService);
                b.bind(CircuitBreakerService.class).toInstance(circuitBreakerService);
                b.bind(BigArrays.class).toInstance(bigArrays);
                b.bind(PageCacheRecycler.class).toInstance(pageCacheRecycler);
                b.bind(ScriptService.class).toInstance(scriptService);
                b.bind(AnalysisRegistry.class).toInstance(analysisModule.getAnalysisRegistry());
                b.bind(IngestService.class).toInstance(ingestService);
                b.bind(IndexingPressure.class).toInstance(indexingLimits);
                b.bind(UsageService.class).toInstance(usageService);
                b.bind(AggregationUsageService.class).toInstance(searchModule.getValuesSourceRegistry().getUsageService());
                b.bind(NamedWriteableRegistry.class).toInstance(namedWriteableRegistry);
                b.bind(MetadataUpgrader.class).toInstance(metadataUpgrader);
                b.bind(MetaStateService.class).toInstance(metaStateService);
                b.bind(PersistedClusterStateService.class).toInstance(persistedClusterStateService);
                b.bind(IndicesService.class).toInstance(indicesService);
                b.bind(MetadataCreateIndexService.class).toInstance(metadataCreateIndexService);
                b.bind(MetadataCreateDataStreamService.class).toInstance(metadataCreateDataStreamService);
                b.bind(MetadataDataStreamsService.class).toInstance(metadataDataStreamsService);
                b.bind(MetadataUpdateSettingsService.class).toInstance(metadataUpdateSettingsService);
                b.bind(SearchService.class).toInstance(searchService);
                b.bind(SearchTransportService.class).toInstance(searchTransportService);
                b.bind(SearchPhaseController.class).toInstance(new SearchPhaseController(searchService::aggReduceContextBuilder));
                b.bind(Transport.class).toInstance(transport);