confusing fit failure when using set_config(transform_output="pandas")

### Describe the bug

Using `set_config(transform_output="pandas")` in combination with `ColumnTransformer` may result in a failed fit, since indices do not align as expected. The error will not be especially helpful: "ValueError: Found input variables with inconsistent numbers of samples: [705, 527]" (Error appears to be related to merging DataFrames with non-aligned indices, as evident by NaNs and change in shape).

### Steps/Code to Reproduce

```
import pandas as pd
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.pipeline import Pipeline
from sklearn.decomposition import TruncatedSVD
from sklearn import set_config
from sklearn.feature_extraction.text import CountVectorizer

set_config(transform_output="pandas")

d = pd.DataFrame({
    'txt': ['cat eats milk', 'tree says hi', 'bone eats dog'],
}, index=[8, 5, 3])
d


Pipeline([('cv', CountVectorizer()), ('tsvd', TruncatedSVD(n_components=1))]).fit_transform(d.txt)


```

### Expected Results

expected index: [8, 5, 3]

expected behavior: works with ColumnTransformer

### Actual Results

actual index: [0, 1, 2]

actual behavior: doesn't work with ColumnTransformer if other transformers maintain aligned indices

### Versions

```shell
System:
    python: 3.8.16 | packaged by conda-forge | (default, Feb  1 2023, 16:01:55)  [GCC 11.3.0]
executable: /opt/conda/envs/py38/bin/python3.8
   machine: Linux-4.19.0-23-cloud-amd64-x86_64-with-glibc2.10

Python dependencies:
      sklearn: 1.2.2
          pip: 23.0.1
   setuptools: 67.6.1
        numpy: 1.23.5
        scipy: 1.10.1
       Cython: None
       pandas: 1.5.3
   matplotlib: 3.7.1
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/envs/py38/lib/python3.8/site-packages/numpy.libs/libopenblas64_p-r0-742d56dc.3.20.so
        version: 0.3.20
threading_layer: pthreads
   architecture: Haswell
    num_threads: 4

       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /opt/conda/envs/py38/lib/python3.8/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
    num_threads: 4

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/envs/py38/lib/python3.8/site-packages/scipy.libs/libopenblasp-r0-41284840.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell
    num_threads: 4
```

COMMENT:
No problem. 

(You can also remove the SimpleImputer step to get a different error related to the NaNs, which are visible if just transforming with the ColumnTransformer like `ct.fit_transform(X)`)

This shows the misalignment caused by different indices.

```
import pandas as pd
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.decomposition import TruncatedSVD
from sklearn import set_config
from sklearn.impute import SimpleImputer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder

# call to fit will work if this is commented out
set_config(transform_output="pandas")

X = pd.DataFrame({
    'txt': ['cat eats milk', 'tree says hi', 'bone eats dog'],
}, index=[8, 5, 3])

ct = ColumnTransformer([
    ('first', Pipeline([('cv', CountVectorizer()), ('tsvd', TruncatedSVD(n_components=1))]), 0),
    ('ohe', OneHotEncoder(sparse_output=False), [0]),
])

pipe = make_pipeline(ct, SimpleImputer(), GradientBoostingRegressor())

pipe.fit(X, [1, 2, 3])
```

Labels: Bug, module:compose, Pandas compatibility