Checking two properties of a tree
This is not a proof for the statement (since the statement is incorrect if the tree is not balanced), but rather another way to think and solve the problem.
Notice that in any path from the root to a leaf, say $v_1,\dots, v_k$ we must have that the number of green nodes is at most $1$ (by the first property). Also, notice that the number of blue nodes in the path, is the depth of the leaf $v_k$ minus either one or zero, depending on whether there was a green node in that path.
So, in order to count the number of blue nodes in a path you have to do the following two things:

Write at every leaf its depth (can be done in $O(n)$)
Write at every leaf whether there was a green node in the path from the root to it (think about it, it also can be done in $O(n)$)

Then finally you go through all leaves, calculate the number of blue nodes using this information, and make sure all leaves have the same value of it.