Agglomerative clustering training error for seuclidean/mahalanobis affinity and single linkage

### Describe the bug

When trying Agglomerative clustering model training with the affinity as 'seuclidean' or 'mahalanobis' and the linkage as 'single' the training fails. The same affinity values along with other linkage such as 'average' options executes for model training. There's no specification given for this issue. Also, in the code I can see the handling for the single linkage is different and there is some cython code which is not accessible.

### Steps/Code to Reproduce

```

from sklearn.cluster import AgglomerativeClustering
from sklearn.datasets import load_iris
model = AgglomerativeClustering(affinity='mahalanobis', linkage='average')
data = load_iris(as_frame=True)['data']
model.fit(data)

```

### Expected Results

No error should be thrown sig

### Actual Results

![image](https://github.com/scikit-learn/scikit-learn/assets/69189799/c3da5d93-b215-4fd8-8610-a4c8ce632f8d)


### Versions

```shell
System:
    python: 3.8.17 (default, Jul  5 2023, 21:04:15)  [GCC 11.2.0]
executable: /home/albint/miniconda3/envs/myenv/bin/python
   machine: Linux-5.15.0-78-generic-x86_64-with-glibc2.17

Python dependencies:
      sklearn: 1.3.0
          pip: 23.1.2
   setuptools: 67.8.0
        numpy: 1.24.4
        scipy: 1.10.1
       Cython: 3.0.0
       pandas: 2.0.3
   matplotlib: 3.7.2
       joblib: 1.3.1
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /home/albint/miniconda3/envs/myenv/lib/python3.8/site-packages/numpy.libs/libopenblas64_p-r0-15028c96.3.21.so
        version: 0.3.21
threading_layer: pthreads
   architecture: Haswell

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /home/albint/miniconda3/envs/myenv/lib/python3.8/site-packages/scipy.libs/libopenblasp-r0-41284840.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: libgomp
       filepath: /home/albint/miniconda3/envs/myenv/lib/python3.8/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
```

COMMENT:
So a few things in play here.

First, the documentation for `affinity` is outdated and incorrect (note that the keyword is also **deprecated**), whereas the documentation for `metric` _more accurate_ but still not complete. What's missing is that when `connectivity=None` and `linkage="single"` (and `affinity!="precomputed"`), any valid pairwise distance metric (i.e. `metric in sklearn.metrics.pairwise._VALID_METRICS`) works.

Second, the support for general pairwise distance metrics can actually be extended to even when `connectivity!=None` and `linkage!="single"` if we ditch the use of `paired_distances` and use the underlying distance metric directly, though it may a be a bit tricky to ensure no performance regression. This indeed must happen once we deprecate `paired_distances` (https://github.com/scikit-learn/scikit-learn/issues/26982).

Third, we do not have any mechanism to forward metric keyword arguments to the underlying metric, so those like `"mahalanobis"` and `"seuclidean"` will not be usable until we fix this.

Each of these could probably use their own PR 😅

Labels: Bug, help wanted