Use one of the many ToC detection features of the conversion pipeline to workaround it. Field codes (which is what you are referencing here) are not fully supported by the docx input plugin. See
https://manual.calibre-ebook.com/conversion.html for how to control toc detection.