Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy

Assuming that when you are on the “page” sub_category_1 you’re looking at a standard archive for that term, you can do this…

The main query is already for the posts in sub_category_1 so get a list of their IDs:

global $wp_query;
$post_ids = wp_list_pluck( $wp_query->posts, 'ID' );

Then you simply need to get a list of the terms from brand which are assigned to those posts:

$terms = get_terms( array(
    'taxonomy' => 'brand',
    'object_ids' => $post_ids,
) );

$terms will be an array of the WP_Term objects.