### Elasticsearch Version

7.17.1

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Ubuntu 18.04

### Problem Description

Problem originally discussed [here](https://discuss.elastic.co/t/auto-expand-replicas-not-working-on-enrich-index/313569). See the complete discussion and the things I've tried there.

Summary
* 3 nodes cluster, all nodes have all roles (`node.roles` is not defined, so nodes have all roles)
* All system indices with `auto_expand_replicas: "0-all"` are not replicated. Problem exists on enrich indices, kibana indices, monitoring indices , etc.
* Problem can be reproduced with a regular, user-defined index simply by setting `auto_expand_replicas: "0-all"` in index settings as per the reproduction script below

On my cluster, the indices always have 0 replicas. I've tried to force set `number_of_replicas` to a higher value with no luck, value is reverted to 0 immediately. I've enabled TRACE logging on a few loggers around allocation, I've got plenty of logs but none mentioned the inability to replicate thoses indices...

Can you help troubleshoot the issue?

Thanks in advance,

Cheers,
David

### Steps to Reproduce

Kibana script
```
PUT /testing_auto_expand_replicas
{
  "settings": {
    "auto_expand_replicas": "0-all"
  }
}

GET /testing_auto_expand_replicas/_settings

GET _cluster/allocation/explain?include_yes_decisions
{
  "index": "testing_auto_expand_replicas",
  "shard": 0,
  "primary": true
}
```

### Logs (if relevant)

_No response_
server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDeciderTests.java
service.reroute(ClusterState.EMPTY_STATE, "initial state"),
            randomFrom(SingleNodeShutdownMetadata.Type.REMOVE, SingleNodeShutdownMetadata.Type.REPLACE)
        );
        RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state, null, null, 0);
        allocation.debugDecision(true);
        Decision decision = decider.shouldAutoExpandToNode(indexMetadata, DATA_NODE, allocation);
        assertThat(decision.type(), equalTo(Decision.Type.NO));
        assertThat(decision.getExplanation(), equalTo("node [" + DATA_NODE.getId() + "] is preparing for removal from the cluster"));
    }
    private ClusterState prepareState(ClusterState initialState, SingleNodeShutdownMetadata.Type shutdownType) {
        final String targetNodeName = shutdownType == SingleNodeShutdownMetadata.Type.REPLACE ? randomAlphaOfLengthBetween(10, 20) : null;
        final SingleNodeShutdownMetadata nodeShutdownMetadata = SingleNodeShutdownMetadata.builder()
            .setNodeId(DATA_NODE.getId())
            .setType(shutdownType)
            .setReason(this.getTestName())
            .setStartedAtMillis(1L)
            .setTargetNodeName(targetNodeName)
            .build();
        NodesShutdownMetadata nodesShutdownMetadata = new NodesShutdownMetadata(new HashMap<>()).putSingleNodeMetadata(
            nodeShutdownMetadata
        );
        return ClusterState.builder(initialState)
            .nodes(DiscoveryNodes.builder().add(DATA_NODE).build())
            .metadata(
                Metadata.builder().put(IndexMetadata.builder(indexMetadata)).putCustom(NodesShutdownMetadata.TYPE, nodesShutdownMetadata)
            )
            .build();
    }
}