I don't understand why this error occurred, but this entry in CHANGES
entry may be related:
,----
| − If your Emacs is 29 or newer and you use ‘desktop.el’ to save
| and restore Emacs sessions, be careful before you update
| AUCTeX; You should attempt to update only after
| 1. you kill all buffer under former AUCTeX modes which have
| overlapped name with Emacs built-in TeX modes, and
| 2. you terminate the current Emacs session.
| The modes with such overlapped name are ‘plain-tex-mode’,
| ‘latex-mode’, ‘doctex-mode’ and ‘texinfo-mode’. (The above
| prescription ensures no buffer of such modes is recorded in
| the desktop file. Otherwise those buffers would be restored
| in the built-in modes, not AUCTeX modes, after the update of
| AUCTeX.)
`----