### Elasticsearch Version

8.7.1

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

any

### Problem Description

When trying to use the [Import dangling index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/dangling-index-import.html), we've got the following message:
```
[2023-05-04T00:13:58,991][WARN ][o.e.g.LocalAllocateDangledIndices] [nemo002-master]ignoring dangled index [[test_index_20230503_1/EvcvFgJtRqiWxbDXqxQ4Rg]] on node [{nemo000-master}{CAePyz7iSdeT8NgWO9e3Ng}{h0Bc5NvPSXqZ0yztBTH83w}{nemo000-master}{1.2.3.4}{1.2.3.4:9303}{m}{8.7.1}{xpack.installed=true, cluster_id=john, rack_id=doe}] since its current compatibility version [8.4.3] is later than the oldest versioned node in the cluster [8.7.1]
```
Obviously, `8.4.3` is not later than `8.7.1`. Checking the source code, it can be seen that instead of the minimum node version, the master node's version is being logged:
https://github.com/elastic/elasticsearch/blob/ac9822be7247d33ad29ced39ae2eb5e4d3fcd189/server/src/main/java/org/elasticsearch/gateway/LocalAllocateDangledIndices.java#L143-L150

### Steps to Reproduce

have an ES cluster with mixed node versions
have an index created by a node of a newer version dangling in a node with an older version
try to import the dangling index: `POST /_dangling/<uuid>?accept_data_loss=true`

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/gateway/LocalAllocateDangledIndices.java
logger.info("importing dangled indices {} from [{}]", sb.toString(), request.fromNode);
                    RoutingTable routingTable = routingTableBuilder.build();
                    ClusterState updatedState = ClusterState.builder(currentState)
                        .metadata(metadata)
                        .blocks(blocks)
                        .routingTable(routingTable)
                        .build();
                    
                    return allocationService.reroute(
                        ClusterState.builder(updatedState).routingTable(routingTable).build(),
                        "dangling indices allocated",
                        listener.reroute()
                    );
                }
                @Override
                public void onFailure(Exception e) {
                    listener.clusterStateUpdate().onFailure(e);
                }
                @Override
                public void clusterStateProcessed(ClusterState oldState, ClusterState newState) {
                    listener.clusterStateUpdate().onResponse(new AllocateDangledResponse());
                }
            });
        }
    }
    @SuppressForbidden(reason = "legacy usage of unbatched task") 
    private void submitUnbatchedTask(@SuppressWarnings("SameParameterValue") String source, ClusterStateUpdateTask task) {
        clusterService.submitUnbatchedStateUpdateTask(source, task);
    }
    public static class AllocateDangledRequest extends TransportRequest {