Thanks @Lew_Grothe, I do see the issue now. There are two lines of code that cause this when using a theme header, first:
const maximumOffset = $("#topic-bottom").offset().top + progressHeight;
offset.top here gets the element’s position from the top of the document. Later in the code, the position of the progress bar is calculated based on the height of #main minus said offset:
const bottom = $("#main").height() - maximumOffset;
But when adding an element to the body before #main, the offset will be misaligned with #main. I will prepare a PR tomorrow and propose to target the body element, as you suggest, it makes sense to me.