Thunderbolt 3 dock disconnects when MacBook sleeps
Given that the computer sleep seems to be the problem, I turned off the "Power Nap", and it seems to be working for me now.


System Preferences > Energy Saver
Power Adapter tab
Uncheck "Enable Power Nap while plugged into a power adapter


This seems to be preventing the computer from sleeping and my external monitor has been fine. Note that I still turn off the display after 10 minutes, so I don't think this is harmful to the computer.

Of course, this setup is only when plugged in, which is the only time I care about the external monitor.