My guess is that the OPs book started life as a footnoted PDF that someone read into MS Word, used its convert footnotes to endnotes tool, then saved to Filtered HTML, and tossed that into calibre's conversion engine. One of my acolytes had a similar problem when they did that.
This despite me telling them countless times: "You should save as DOCX and toss that into calibre's conversion hurdy-gurdy."
"But I saw this Youtube video that said you
had to use Filtered HTML."
"When was the video published?"
"How would I know?"
This won't help the OP unless they can lay their hands on the PDF.
BR