Please check for Solr Pivots
Solr Pivot should be able to provide hierarchical facets, which you can use as facet.pivot = tag_id,count
.
You should get back results as
tag_id 1
count 5
tag id 2
count 2
count 5
tag id 3
count 2
You can do the count consolidation on the client side.