Your special case is right. More generally:

Let $f\left(x\right)=x+b$ with $b\neq 0$.
Let $g\left(x\right)=cx^2+dx+e$ with $c>0$, $d\in\mathbb R$ and $e\in\mathbb R$.

In fact, it is clear that every composition of $f$'s and $g$'s is a polynomial of positive degree and with positive leading coefficient (since $c>0$).

If we have a polynomial $P\in\mathbb R\left[X\right]$ which is a composition of $f$'s and $g$'s, we can always reconstruct the last step of the composition. Namely, we search for a nonnegative real $u$ such that $P-u=cQ^2+dQ+e$ for some polynomial $Q\in \mathbb R\left[X\right]$ of positive degree and with positive leading coefficient. If the last step has been a $g$, then $u=0$ must work; if the last step was an $f$, but some $g$ occured in the composition, then we must have a solution with $u\neq 0$ (in fact, if the last steps were $g$, $f$, $f$, ..., $f$ in this order, with $f$ occuring $k$ times, then $u$ must be $kb\neq 0$); if the composition consists of $f$'s only, then there is no solution (because $P$ must have degree $1$). The important thing is that the $u$, if it exists, is unique. In fact, if there would be two different $u$'s, then the two corresponding $Q$'s - let's call them $Q_1$ and $Q_2$ - would satisfy $\left(cQ_1^2+dQ_1+e\right)-\left(cQ_2^2+dQ_2+e\right)=w$ for some nonzero real $w$ (here, $w$ is the difference of the two $u$'s). This equation rewrites as $c\left(Q_1-Q_2\right)\left(Q_1+Q_2+1\right)=\left(c-d\right)Q_1-\left(c-d\right)Q_2+w$. Thus, (remembering that $c>0$) we conclude that

$\deg\left(Q_1-Q_2\right)+\deg\left(Q_1+Q_2+1\right)=\deg\left(c\left(Q_1-Q_2\right)\left(Q_1+Q_2+1\right)\right)$
$=\deg\left(\left(c-d\right)Q_1-\left(c-d\right)Q_2+w\right)\leq\max\left\lbrace \deg Q_1,\deg Q_2\right\rbrace$.

But at least one of the two degrees $\deg\left(Q_1-Q_2\right)$ and $\deg\left(Q_1+Q_2+1\right)$ must actually be equal to $\max\left\lbrace \deg Q_1,\deg Q_2\right\rbrace$ (because $Q_1$ and $Q_2$ are linear combinations of $Q_1-Q_2$ and $Q_1+Q_2$), and thus the other one must be zero or $-\infty$ (the degree of the zero polynomial). In other words, one of the polynomials $Q_1-Q_2$ and $Q_1+Q_2+1$ is constant. But the polynomial $Q_1+Q_2+1$ cannot be constant (because $Q_1$ and $Q_2$ have positive degree and positive leading coefficients). Hence, the polynomial $Q_1-Q_2$ is constant.

So let $Q_1-Q_2=k$ for $k\in\mathbb R$. Then, $\left(cQ_1^2+dQ_1+e\right)-\left(cQ_2^2+dQ_2+e\right)=w$ rewrites as $ck\left(Q_1+Q_2\right)+dk=0$ (since $Q_1-Q_2=k$). Hence, the polynomial $ck\left(Q_1+Q_2\right)$ also must be constant, so that $ck=0$ (since the polynomial $Q_1+Q_2$ is not constant, because $Q_1$ and $Q_2$ are two polynomials with positive degree and positive leading terms). Since $c>0$, this yields $k=0$, and thus $Q_1-Q_2=k=0$, so that $Q_1=Q_2$, and therefore $0=\left(cQ_1^2+dQ_1+e\right)-\left(cQ_2^2+dQ_2+e\right)=w$, contradicting $w\neq 0$.