In the economic model, cost of the externality should go to reverse the damage, or compensate those harmed.
This breaks down if the government taxes a good due to externality, but spends the proceeds on something else.
Raising government revenues is arguably a social good, but does not benefit or compensate those harmed. Without targeted mitigation or compensation, such policies are simply sin taxes.
I don't think this is a problem with economists, who understand this well. you can not "set a tax precisely at the rate of the externality" without finding the cost of the externality to those impacted.