### 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
randomFrom(SingleNodeShutdownMetadata.Type.REMOVE, SingleNodeShutdownMetadata.Type.REPLACE)
        );
        RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state, null, null, 0);
        RoutingNode routingNode = RoutingNodesHelper.routingNode(DATA_NODE.getId(), DATA_NODE, shard);
        allocation.debugDecision(true);
        Decision decision = decider.canAllocate(shard, routingNode, allocation);
        assertThat(decision.type(), equalTo(Decision.Type.NO));
        assertThat(decision.getExplanation(), equalTo("node [" + DATA_NODE.getId() + "] is preparing to be removed from the cluster"));
    }
    public void testShardsCanRemainOnRestartingNode() {
        ClusterState state = prepareState(
            service.reroute(ClusterState.EMPTY_STATE, "initial state"),
            SingleNodeShutdownMetadata.Type.RESTART
        );
        RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state, null, null, 0);
        RoutingNode routingNode = RoutingNodesHelper.routingNode(DATA_NODE.getId(), DATA_NODE, shard);
        allocation.debugDecision(true);
        Decision decision = decider.canRemain(null, shard, routingNode, allocation);
        assertThat(decision.type(), equalTo(Decision.Type.YES));
        assertThat(
            decision.getExplanation(),
            equalTo("node [" + DATA_NODE.getId() + "] is preparing to restart, but will remain in the cluster")
        );
    }
    public void testShardsCannotRemainOnRemovingNode() {
        ClusterState state = prepareState(
            service.reroute(ClusterState.EMPTY_STATE, "initial state"),
            randomFrom(SingleNodeShutdownMetadata.Type.REMOVE, SingleNodeShutdownMetadata.Type.REPLACE)
        );
        RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state, null, null, 0);