Make multisite non-existing subdomains go to homepage instead of Index of/ page

Have you tried setting the NOBLOGREDIRECT PHP constant within wp-config.php? That constant can be used to redirect users wherever you want when they visit a subdomain within multisite that doesn’t exist.

Here’s an example of that constant in use within wp-config.php:

define( 'NOBLOGREDIRECT', 'https://example.com' );