I found a solution, if not an answer to this problem, was to outsource the Javascript asset serving of highlight.js to the cloudflare cdn. While this does not answer the original question of why this incorrect escaping was happening, it did ultimately end up solving my pdf rendering problem.
That being said, I would still be interested in why this problem arose in the first place. Feel free to lend me your insight should you have any.