Trick Mac into thinking it has an external display
Solution 1:
There’s no good way to set this in software, but you can get dummy display plugs for a fraction of the cost and space of an actual display.
They connect to a display output & fool the computer into thinking it's really a display. They're usually used for headless servers, but there's no reason I can think of you couldn't use one for your "second monitor" situation.
They come is various forms, HDMI, DVI, DP, VGA etc. Google/eBay/Amazon etc can find lots of them. Search for Ghost display or headless display. Quality on these can vary widely so consider buying some spares if you are not buying from a vendor with a return policy that you like.
Random pic of many types, anonymised