The math doesn't account for anything. The formula they published literally has (4 * 1/4) as part of the equation, hidden behind Greek letters, to make it appear more sophisticated.
It's "trade deficit / imports" without any care to why those numbers exist on a case-by-case basis.
This wasn't a thought out solution that took into account the vast multivariate things that happen in the real world, including those you mentioned.
They also used CCTLDs instead of countries which is how we ended up with:
* a tiny Australian island got much higher tariffs than Australia * tariffs on an uninhabited island * an island that is only inhabited by a joint US/UK military base getting tariffs