multiple monitors – Ubuntu 20.04 forgets about external display after reboot

I have a Asus Zenbook UX305C with an Intel 515 on-board GPU. I have an external monitor connected over HDMI. Sometimes, when I do the wrong combination of unplugging the external monitor, shutting down and/or closing the lid, the laptop will “forget” about the graphical setup and the following happens:

  • It doesn’t properly boot, I can only access Gnome when I first boot into recovery mode and then resume normal boot.
  • Even then, the external display is not recognized at all.
  • xrandr also reports the wrong stats about the built-in display. It’s listed only as “unknown display”.
    Then again through seemingly random combination of reboots and re-plugging the external monitor, I get the whole setup to work again.

I am running a vanilla Ubuntu 20.04 with no notable special setup. I’ve looked at the other questions here, but none describe my issue or were helpful in resolving it. Any ideas on how to approach figuring this out?