ColumnTransformer raises a TypeError when used in a Pipeline

### Describe the bug

`ColumnTransformer` raises error _ColumnTransformer is subscriptable after it is fitted_ when used in a `Pipeline`.

This happens when the arguments to expected methods are gathered in `Pipeline._check_method_params`: destructuring a `ColumnTransformer` instance into a 2-tuple `name, step` is translated into calls to `ColumnTransformer.__getitem__`, which attempts to access `ColumnTransformer.named_transformers_`, which only becomes available after the transformer has been fit.

I'm not sure how that happens because `named_transformers_` is a `@property`. FWIW, `hasattr` returns `False` before a call to `fit`:

```python
ct = ColumnTransformer([])
print(hasattr(ct, "named_transformers_"))

ct.fit(np.empty((0, 0)))
print(hasattr(ct, "named_transformers_"))
```

### Steps/Code to Reproduce

This is the first example from the `ColumnTransformer` [class documentation](https://scikit-learn.org/stable/modules/generated/sklearn.compose.ColumnTransformer.html) wrapped in a single-step `Pipeline`:
```python
import numpy as np
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import Normalizer
ct = ColumnTransformer(
    [("norm1", Normalizer(norm='l1'), [0, 1]),
     ("norm2", Normalizer(norm='l1'), slice(2, 4))])
X = np.array([[0., 1., 2., 2.],
              [1., 1., 0., 1.]])

Pipeline([ct]).fit(X)
```

### Expected Results

- No error is raised
- The result is essentially equivalent to calling `ct.fit(X)`

### Actual Results

```
AttributeError                            Traceback (most recent call last)
File [...]/.venv/lib/python3.12/site-packages/sklearn/compose/_column_transformer.py:1226, in ColumnTransformer.__getitem__(self, key)
   1225 try:
-> 1226     return self.named_transformers_[key]
   1227 except AttributeError as e:

File [...]/.venv/lib/python3.12/site-packages/sklearn/compose/_column_transformer.py:582, in ColumnTransformer.named_transformers_(self)
    581 # Use Bunch object to improve autocomplete
--> 582 return Bunch(**{name: trans for name, trans, _ in self.transformers_})

AttributeError: 'ColumnTransformer' object has no attribute 'transformers_'

The above exception was the direct cause of the following exception:

TypeError                                 Traceback (most recent call last)
Cell In[33], line 11
      5 ct = ColumnTransformer(
      6     [("norm1", Normalizer(norm='l1'), [0, 1]),
      7      ("norm2", Normalizer(norm='l1'), slice(2, 4))])
      8 X = np.array([[0., 1., 2., 2.],
      9               [1., 1., 0., 1.]])
---> 11 Pipeline([ct]).fit(X)

File [...]/.venv/lib/python3.12/site-packages/sklearn/base.py:1473, in _fit_context.<locals>.decorator.<locals>.wrapper(estimator, *args, **kwargs)
   1466     estimator._validate_params()
   1468 with config_context(
   1469     skip_parameter_validation=(
   1470         prefer_skip_nested_validation or global_skip_validation
   1471     )
   1472 ):
-> 1473     return fit_method(estimator, *args, **kwargs)

File [...]/.venv/lib/python3.12/site-packages/sklearn/pipeline.py:468, in Pipeline.fit(self, X, y, **params)
    421 @_fit_context(
    422     # estimators in Pipeline.steps are not validated yet
    423     prefer_skip_nested_validation=False
    424 )
    425 def fit(self, X, y=None, **params):
    426     """Fit the model.
    427 
    428     Fit all the transformers one after the other and sequentially transform the
   (...)
    466         Pipeline with fitted steps.
    467     """
--> 468     routed_params = self._check_method_params(method="fit", props=params)
    469     Xt = self._fit(X, y, routed_params)
    470     with _print_elapsed_time("Pipeline", self._log_message(len(self.steps) - 1)):

File [...]/.venv/lib/python3.12/site-packages/sklearn/pipeline.py:360, in Pipeline._check_method_params(self, method, props, **kwargs)
    355     return routed_params
    356 else:
    357     fit_params_steps = Bunch(
    358         **{
    359             name: Bunch(**{method: {} for method in METHODS})
--> 360             for name, step in self.steps
    361             if step is not None
    362         }
    363     )
    364     for pname, pval in props.items():
    365         if "__" not in pname:

File [...]/.venv/lib/python3.12/site-packages/sklearn/compose/_column_transformer.py:1228, in ColumnTransformer.__getitem__(self, key)
   1226     return self.named_transformers_[key]
   1227 except AttributeError as e:
-> 1228     raise TypeError(
   1229         "ColumnTransformer is subscriptable after it is fitted"
   1230     ) from e
   1231 except KeyError as e:
   1232     raise KeyError(f"'{key}' is not a valid transformer name") from e

TypeError: ColumnTransformer is subscriptable after it is fitted
```

### Versions

```shell
System:
    python: 3.12.4 (v3.12.4:8e8a4baf65, Jun  6 2024, 17:33:18) [Clang 13.0.0 (clang-1300.0.29.30)]
executable: [...]/.venv/bin/python3.12
   machine: macOS-15.1.1-arm64-arm-64bit

Python dependencies:
      sklearn: 1.6.0
          pip: None
   setuptools: 75.6.0
        numpy: 1.26.4
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.9.3
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 11
         prefix: libopenblas
       filepath: [...]/.venv/lib/python3.12/site-packages/numpy/.dylibs/libopenblas64_.0.dylib
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: armv8

       user_api: openmp
   internal_api: openmp
    num_threads: 11
         prefix: libomp
       filepath: [...]/.venv/lib/python3.12/site-packages/sklearn/.dylibs/libomp.dylib
        version: None
```
```

COMMENT:
The only other non-test usage of `named_transformers_` (that my IDE can find) is on [Line 328 in `sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py`](https://github.com/scikit-learn/scikit-learn/blob/1.6.0/sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py#L328) using a string key:

```python
encoder = self._preprocessor.named_transformers_["encoder"]
```

One way to support both the usage above _and_ destructuring into a tuple is to change the behaviour at runtime based on the type of `key` argument: 
- If it's an `int`, access the transformer collection by index.
- Otherwise, i.e. if it's a `str`, keep the current behaviour.

Labels: Bug, Needs Triage