If you have the spoor extension enabled then the index.html from src/exensions/adapt-contrib-spoor/required will be added to the build instead. You'd also need to add your script tags to index_lms.html as that's the launch page when the course is run from an LMS.
It would be better to add your code within the menu's .js I would think