Thought process to solve tree based Dynamic Programming problems
I don't know if this helps, but I also struggled a great deal with DP problems on trees, and what helped for me was considering some simpler problems first, and really do a bunch of exercises of this type.  It also really helps to program them in (e.g.) Python so that you get some hands-on experience.

So, perhaps it is better to start with a simpler tree problem first, like (weighted) Vertex Cover or (weighted) Independent Set?

In both these cases (they are similar, but let us focus on Vertex Cover), the
entire solution of a subtree can be summarized in the root of the subtree with
two numbers: the optimal solution if the root of the subtree is in the vertex
cover, and the optimal solution if the root of the subtree is not in the
vertex cover (but covered from below).

So the plan is to store, for each node $u$, two numbers, $u_{\text{in}} = c_i$
and $u_{\text{in}} = c_o$, and in the end, we will look at what are the values
in the root node $r$, i.e. $r_{\text{in}}$ and $r_{\text{out}}$.

The Algorithm

The algorithm is then quite simple.  For the base case, starting at the leaves, in leaf node $v$, you store $v_{\text{in}} = w(v)$ and $v_{\text{out}} = 0$.  Clearly, in the subtree with only one node, there are no edges to cover, so this is quite easy.

Then the rest of the algorithm is given a node $v$ with children $u_1, \dots, u_d$, we need to compute two cases.


$v$ is in the vertex cover: then the optimal solution is $v_{\text{in}} = w(v) + \sum_{u \in u_1 \dots u_d} \min(u_{\text{in}}, u_{\text{out}})$
$v$ is not in the vertex cover, so all children must be, hence $v_{\text{out}} = \sum_{u \in u_1 \dots u_d} u_{\text{in}}$


Now, the only thing we need to do is return the result of the root node $r$, which can either be in or not in the vertex cover, so we return
$$ \min( r_{\text{in}}, r_{\text{out}}) $$



In other words, we found out what information we need in the "separator" of a
subtree, and how can combine the information from the subtree with the rest of
the tree.


Exercise: Solve Weighted Vertex Cover and Weighted Independent Set on trees.
Exercise 2: Solve Weighted Dominating Set, which needs one more state, namely in the dominating set, not in the dominating set but dominated, not yet dominated (dominated from above).