Sunshine 'Apollo' already has this capability. It's a fork of Sunshine that improves on the regular version in practically every way. It automatically creates a virtual display to match your chosen devices resolution, aspect ratio and refresh rate. The same dev has also created a fork of Moonlight called 'Artemis' which again, greatly improves upon the standard version. With Artemis, you can even connect to your PC with your phone in portrait mode, and again Apollo manages to match your devices display perfectly. I highly recommend both to anyone interested in streaming their PC to other devices.
Here's a link to the GitHub page for anyone that may be interested.
https://github.com/ClassicOldSong/Apollo