Let me start by altering a bit your notations: we consider a differential operator $P$ defined by $$ P=\sum_{1\le j\le n}p_j(x) D^j, \quad D=-i\frac{d}{dx}. $$ The formal adjoint is (there is a typo in your statement with a $(-1)^n$ which should be replaced by $(-1)^j$) $$ P^*=\sum_{1\le j\le n} D^j p_j(x). $$$$ P^*=\sum_{1\le j\le n} D^j \overline{p_j(x)}. $$ Instead of fighting to get conditions on the $p_j$ to get $P=P^*$, I propose to use the Weyl quantization, introduced by Hermann Weyl in 1926: let us define $$ (Pv)(x)=\iint \sum_{0\le j\le n} q_j\bigl(\frac{x+y}{2}\bigr)\xi^j e^{i(x-y)\xi} v(y) dy d\xi(2π)^{-n}. $$ Then an iff condition to get formal self-adjointness is that $$\forall (x,\xi)\in \mathbb R^2, \quad \sum_{0\le j\le n} q_j(x)\xi^j\in \mathbb R, $$ which in that case means $ \forall x\in \mathbb R, q_j(x)\in \mathbb R. $ You can of course express the Weyl symbol $q(x,\xi)=\sum_{1\le j\le n}q_j(x)\xi^j$ of $P$ in terms of its standard symbol $$ p(x,\xi)=\sum_{1\le j\le n}p_j(x)\xi^j, $$ by the formula $ q=\exp(-\frac{i}{2}D_xD_\xi)p, \quad D_x=-i\frac{d}{dx}, D_\xi=-i\frac{d}{d\xi}. $ As a consequence, an iff condition for formal selfadjointness is $$\forall (x,\xi)\in \mathbb R^2, \quad \bigl(\exp(-\frac{i}{2}D_xD_\xi)p\bigr)(x,\xi)\in \mathbb R. $$