Let $T_n$ be the number of ordered, rooted trees with $n$ nodes, where each node has degree $\le 3.$ These are exactly the $n$-node trees that can be generated by the random process. The probability that a given $n$-node tree is generated is $3^{-n},$ for each node is associated with a factor of $1/3,$ the probability that of having the number of children it has (or does not have, in the case of the leaves.) Therefore, the probability of generating a tree with exactly $n$ nodes is $$p_n=3^{-n}T_n.$$
$T_n$ satisfies the recurrence relation
$$T_n = T_{n-1} + \sum_{k=1}^{n-2}{T_kT_{n-1-k}},\tag{1}$$
since the root may have either a single subtree with $n-1$ nodes, or two subtrees, one with $k$ nodes and one with $n-k-1$ nodes.
Notice that we distinguish the case where the first subtree has $k$ nodes from the case where the second subtree has $k$ nodes. This is what makes it an ordered tree. It's not the same thing as a binary tree, for when there is only one subtree we don't care if it the left or right subtree. It's clear from the description of the random process that this is the kind of tree we want.
Now $(1)$ is almost identical to the recurrence relation for the Motzkin numbers
$$M_n = M_{n-1} + \sum_{k=0}^{n-2}{M_kM_{n-2-k}},$$
and $T_1=M_0=1, T_2=M_1=1,$ so that $T_n=M_{n-1},$ and $\boxed{p_n=3^{-n}M_{n-1}}.$
The Wikipedia article linked above gives a more convenient formula for calculating the Motzkin numbers a s a three-term recurrence, and a closed-form expression as a sum involving binomial coefficients and Catalan numbers.
Using this closed form expression, I was able to obtain a closed-form formula for the OP's question, for the OP's question, but I can't see how to simplify it into something more useful than computing the $p_n'$s individually and adding them up. For what it's worth,$$
Pr(X>M)= 1 - \sum_{n=1}^{M-1}\sum_{k=0}^{\lfloor (n-1)/2\rfloor}{\left[\binom{n-1}{k,k,n-1-2k}-\binom{n-1}{k+1,k-1,n-1-2k}\right]}
$$