I just realized that I can at least implement a somewhat lame workaround, which is to automatically switch to the internal screen from the hibernate command. That appears to work okay. It would still be interesting to know how xrandr or whatever is behind it actually works, though (and document it properly).