Multi-Site Subdomain: Show master site under subdomain if no sub site exists

You’d need to use a plugin to manage domain aliases like that. Try Mercator by Human Made. Once installed you will see a new tab ‘Aliases’ when you edit a site in network admin dashboard and you will be able to add and activate domain aliases for a site.

Keep in mind that this is not a good for SEO since it will introduce duplicate content issues (same content on different URLs).