thanks for answering so far!
I have an update: ultimately, the fault was mine. I overlooked a section of the code that I hadn’t shared.
Specifically, when building the final_model with the best parameters selected via GridSearchCV, I failed to include the preprocessing step in the pipeline. As a result, the final model was working with categorical variables that hadn’t been transformed by the OneHotEncoder.
Sorry for not sharing the whole code, the idea of the question was more "theoretical", as I believed that there was something that I was not understanding correctly in the ColumnTransformer function.
Thank you so much, I think I can close this thread.
Bests!