Same problem, I spent 3 hours looking for the problem. I would never have believed that it would come from RankMath but by disabling it, everything works.
For me, it is a JS problem because my posts that were loaded with Ajax, when clicking on Prev/Next, integrated the entire >head> tag of the site and the header.
I disabled RankMath, waiting for an update.