text: Title: Improve error message when object is passed to Trainer callbacks
  Body: ### Bug description
  
  I use torch==1.13.1 and lightning==2.2.0, and multiple callbacks in Trainer, it will raise Error "ValueError: Expected a parent". I have read the docs  and github issues about this problem[https://github.com/Lightning-AI/pytorch-lightning/issues/17485](url), but the different thing is that I when I remove the TensorBoardLogger from callbacks list in Trainer, the code is working correctly.
  
  ### What version are you seeing the problem on?
  
  v2.2
  
  ### How to reproduce the bug
  
  ```python
  '''python
  import lightning.pytorch as pl
  if __name__ == "__main__":
      id2label = {}
      label2id = {}
  
      for i, label in enumerate(cf.new_labels):
          id2label[i] = label
          label2id[label] = i
      bert_config=AutoConfig.from_pretrained(cf.base_model_path,num_labels=cf.num_labels,id2label=id2label,label2id=label2id)
      early_stop_callback = pl.callbacks.EarlyStopping(
          monitor='val_f1',
          min_delta=0.00,
          patience=20,
          verbose=True,
          mode='max'
      )
      model_checkpoint_callback = pl.callbacks.ModelCheckpoint(
          monitor='val_f1',
          dirpath=cf.save_best_model_path,
          filename='best-{epoch:02d}-{val_f1:.2f}',
          save_top_k=1,
          mode='max',
      )
      tb_logger=pl.loggers.TensorBoardLogger(cf.log_path, name=cf.log_path.strip('.json'))
      pl.seed_everything(42)
      data_module=ContrastiveDataModule()
      model=ContrastiveModel(bert_config)
      trainer=pl.Trainer(max_epochs=100,devices=[2],callbacks=[early_stop_callback,model_checkpoint_callback,tb_logger],gradient_clip_val=1)
  trainer.fit(model,data_module)
  '''
  ```
  
  
  ### Error messages and logs
  
  ```
  Traceback (most recent call last):
    File "/xx/script/src/model_lightning.py", line 411, in <module>
      trainer=pl.Trainer(max_epochs=100,devices=[2],callbacks=[early_stop_callback,model_checkpoint_callback,tb_logger],gradient_clip_val=1)
    File "/home/huangfu/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/utilities/argparse.py", line 70, in insert_env_defaults
      return fn(self, **kwargs)
    File "/home/huangfu/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py", line 430, in __init__
      self._callback_connector.on_trainer_init(
    File "/yy/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 79, in on_trainer_init
      _validate_callbacks_list(self.trainer.callbacks)
    File "/yy/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 227, in _validate_callbacks_list
      stateful_callbacks = [cb for cb in callbacks if is_overridden("state_dict", instance=cb)]
    File "/yy/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 227, in <listcomp>
      stateful_callbacks = [cb for cb in callbacks if is_overridden("state_dict", instance=cb)]
    File "/yy/miniconda3/envs/autolabel/lib/python3.9/site-packages/lightning/pytorch/utilities/model_helpers.py", line 42, in is_overridden
      raise ValueError("Expected a parent")
  ValueError: Expected a parent
  ```
  
  
  ### Environment
  
  <details>
    <summary>Current environment</summary>
  
  ```
  #- PyTorch Lightning Version :2.2.0
  #- PyTorch Version: 1.13.1
  #- Python version:3.9.19
  #- OS: Linux
  #- CUDA/cuDNN version: 11.7
  #- GPU models and configuration: A custom model based on BERT
  #- How you installed Lightning(`conda`, `pip`, source): conda 
  ```
  
  </details>
  
  
  ### More info
  
  _No response_
  
  cc @borda