docs: Reduce layout shift when navigating between pages (#43758)

This is still not perfect, but it reduces the shift that happens when
navigating between pages that have and don't have the table of contents.
It also tries to reduce the theme flicker that happens by moving its
loading to an earlier moment.

Release Notes:

- N/A
e8a3368226Danilo Leal committed on 11/28/2025, 9:36:47 PM· committed by GitHubparentd4c0b87
3 files changedLine totals unavailable