Use centroid decomposion on $T_1$. Suppose the centroid is $o$, and the distance between $x$ and $o$ is $w_x$. What we need to calculate is $\sum\sum (w_x+w_y) \cdot dis_2(x,y)$. Here $x, y$ are vertices in a connected component $S$ of $T_1$ according to centroid decomposion.
Let's take an edge with length $len$ in $T_2$. The contribution to answer is $len \cdot \sum w \cdot cnt$. It can be easily calculated using tree DP in $O(n)$.
$O(n)$ is too slow, but we can mark those vertices in $S$ as important vertices. Let's compress those unimportant vertices whose degree is no more than $2$, we will get a tree with $O(|S|)$ vertices. Then run a linear tree DP on it is OK.
The total complexity is $O(n \log^2 n)$. The first log is for centroid decomposion, and the second log is for std::sort
to build the compressed tree.
The $O(n \log n)$ solution also exists, we leave it for readers.