Main site media are accessible in subsite domain

Not sure what is the problem here, and when saying that I mean that I do not see the ROI in solving it.

The core issue is that all the sites of a multisite are mapped to the same “physical” directory structure, and media files are simply served from the relevant upload directory when the url can be resolved to the file.

For your problem you probably have your virtual host files mapping both site.com and site2.com to \var\www\html and the webserver does something like map_domain_to_directory().$uri_part which will result in the same file path in both cases.

If it is important to you, you can modify the virtual host of site2 to ignore (send 404?) URLs which include only uploads instead of uploads\site\2. I would not bother as the whole point of using a multisite is to have a common admin, and if you need to have different server level handling of sites, maybe you should consider just using two different installs.