text: Title: TypeError: can not serialize 'DocTransformerOutput' object
  Body: This seems to be exactly #6672, but since that's locked, I cannot comment on it.
  
  ## How to reproduce the behaviour
  
  The example from #6672:
  
  ```python
  import spacy
  sentence = "I love you."
  nlp = spacy.load('en_core_web_trf')
  doc = nlp(sentence)
  doc.to_bytes()
  ```
  
  raises `TypeError: can not serialize 'DocTransformerOutput' object`.
  
  ## Info about spaCy
  
  - **spaCy version:** 3.7.2
  - **Platform:** Linux-6.2.0-1018-lowlatency-x86_64-with-glibc2.37
  - **Python version:** 3.11.4
  - **Pipelines:** en_core_web_trf (3.7.3), de_core_news_lg (3.7.0), de_core_news_md (3.7.0), de_core_news_sm (3.7.0), de_dep_news_trf (3.7.2)