Consider the control system $$ \dot x(t) = X(x(t)) + u(t)\, Y(x(t)) $$ where $X,Y$ are two smooth vector fields and $u$ is a given function.
Consider a reference trajectory $x(.)$ defined on $[0,T]$ such that $Y(x(t))=0$ and $[X,Y](x(t))=0$. Then you can suppose that the trajectory $x(.)$ is associated to the function $u\equiv 0$ on $[0,T]$.
Consider the vector space $K(t) = span \{ (ad^kX \cdot Y)(x(t));\,k\ge 0\}$ where $ad^k X\cdot Y = [X,ad^{k-1}X\cdot Y]$ and $ad^0 X\cdot Y = Y$.
How to show that $p(.)$ defined on $[0,T]$ by $\dot p(t) = -\frac{\partial H}{\partial x}(x(t),p(t))$ where $H(x,p)=p\cdot (F(x)+u\, G(x))$ is such that $$ p(t) \perp K(t)$$ for all $t\in [0,T]$ ?
I would like to show that $p(t)\cdot (ad^kX\cdot Y)(x(t))=0$ for all $t\in [0,T]$.
Ok for $k=0$ by definition of $x(.)$.
Ok for $k=1$ ($p\cdot [X,Y](x(t))=0$) for the same reason.
Ok for $k=2$ because differentiating wrt to the time the equality $p(t)\cdot [X,Y](x(t))=0$ leads to $$u(t)=-\frac{p(t)\cdot [X,[X,Y]](x(t))}{p(t)\cdot [Y,[X,Y]](x(t))}$$ and since $u=0$ this implies $p(t)\cdot [X,[X,Y]](x(t))=0$.
But I can't find the general idea ...
Notation: Hamiltonian lifts are denoted as : $H_X=p\cdot X$, $H_Y=p\cdot Y$, $H_{XY}=p\cdot [X,Y]$, $H_{XXY}=p\cdot [X,[X,Y]]$, $H_{XXXY}=p\cdot [X,[X,[X,Y]]]\ldots$
Using the same idea as the OP, differentiating $p(t)\cdot [X,[X,Y]]=H_{XXY}$ wrt the time leads to $$ \{H_X + u\, H_Y, H_{XXY}\} = 0 $$ where $\{.,.\}$ are the Poisson brackets.
Since $u\equiv 0$, we have $$ \{H_X,H_{XXY}\} = 0 \Rightarrow p(t)\cdot [X,[X,[X,Y]]] = p(t)\cdot ad^3 X\cdot Y =0 $$ and so on ...