How to count posts of a category and of a category limited by a tag

You could run a new instantiation of WP_Query.

$query = new WP_Query([
    'category_name' => '<category_slug>',
    'tag'           => '<tag_slug>',
    'fields'        => 'ids', // To minimize the query, since we just need a count
]);

More on WP_Query

Then all you need to do is reference (integer) $query->found_posts.

Hope that helps. I don’t think there is a better way unfortunately.