You could modify your query on pre_get_posts
.
Example:
// I'd wouldn't hardcode the tags/category ids, but where to store and
// how to retrieve those settings go beyond the scope of this question.
define( 'YIVIS_EXCLUDED_TAG', 12 );
add_action( 'pre_get_posts', 'yivi_excludes_tags' );
function yivi_excludes_tags( $query ) {
if ( $query->is_category() {
$query->set('tag', [ YIVIS_EXCLUDED_TAG * -1 ] );
}
}
With this, every time you are performing a category based query posts tagged with that tag would be excluded from the search. To exclude certain categories on a tag view should be easy enough going on from here.