Well that's a native macrocosm of Magento 2.
As you know, when we are running commands specially compile and static content deploy command.
Magento compiles each and every file with their assets and js and links to pub/static directory.
so when compilation is going on - it will shows the errors as all file are still not compiled/deployed so you only has the option to wait until command execution is completed for all the files.
But for prevention you can make/enable website maintenance mode when you are running command.
So customer of the website will see notice that website is in maintenance mode for few mins.
Once command execution is completed you can disabled maintenance mode for the same.