### 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
this.transportService = transportService;
        this.clusterService = clusterService;
        this.allocationService = allocationService;
        this.indexMetadataVerifier = indexMetadataVerifier;
        transportService.registerRequestHandler(
            ACTION_NAME,
            ThreadPool.Names.SAME,
            AllocateDangledRequest::new,
            new AllocateDangledRequestHandler()
        );
    }
    public void allocateDangled(Collection<IndexMetadata> indices, ActionListener<AllocateDangledResponse> listener) {
        ClusterState clusterState = clusterService.state();
        DiscoveryNode masterNode = clusterState.nodes().getMasterNode();
        if (masterNode == null) {
            listener.onFailure(new MasterNotDiscoveredException());
            return;
        }
        AllocateDangledRequest request = new AllocateDangledRequest(
            clusterService.localNode(),
            indices.toArray(new IndexMetadata[indices.size()])
        );
        transportService.sendRequest(
            masterNode,
            ACTION_NAME,
            request,
            new ActionListenerResponseHandler<>(listener, AllocateDangledResponse::new, ThreadPool.Names.SAME)
        );
    }
    class AllocateDangledRequestHandler implements TransportRequestHandler<AllocateDangledRequest> {