$\newcommand\ZZ{\mathbb{Z}}\newcommand\QQ{\mathbb{Q}}$The statement is true.
Notation: I'm going to change the name of the polynomial to $f$, so that $p$ can be a prime. Fix a prime $p$, let $\QQ_p$ be the $p$-adic numbers, $\ZZ_p$ the $p$-adic integers and $v$ the $p$-adic valuation.
Let $\QQ_p^{alg}$ be an algebraic closure of $\QQ_p$, then $v$ extends to a unique valuation on $\QQ_p^{alg}$, which we also denote by $v$.
We recall the notion of a Newton polygon: Let $f(x) = f_0 + f_1 x + \cdots + f_d x^d$ be a polynomial in $\QQ_p[x]$.
The Newton polygon of $f$ is the piecewise linear path from $(0, v(f_0))$ to $(d, v(f_d))$ which is the lower convex hull of the points $(j, v(f_j))$.
We let the Newton polygon pass through the points $(j, N_j)$, for $0 \leq j \leq d$, and we set $s_j = N_j - N_{j-1}$; the $s_j$ are called the slopes of the Newton polygon. Since the Newton polygon is convex, we have $s_1 \leq s_2 \leq \cdots \leq s_d$.
There are two main Facts about Newton polygons: (Fact 1) Let $f$ and $\bar{f}$ be two polynomials and let the slopes of their Newton polygons be $(s_1, s_2, \ldots, s_d)$ and $(\bar{s}_1, \bar{s}_2, \ldots, \bar{s}_{\bar{d}})$ respectively. Then the slopes of $f \bar{f}$ are the list $(s_1, s_2, \ldots, s_d, \bar{s}_1, \bar{s}_2, \ldots, \bar{s}_{\bar{d}})$, sorted into increasing order. (Fact 2) Let $\theta_1$, $\theta_2$, ... $\theta_d$ be the roots of $f$ in $\QQ_p^{alg}$. Then, after reordering the roots appropriately, we have $v(\theta_j) = -s_j$.
Here is the lemma that does the main work:
Lemma: Let $f$ be a polynomial in $\QQ_p[x]$ which is not in $\ZZ_p[x]$, and suppose that the constant term $f_0$ is in $\ZZ_p$. Then $f^{(2)}$ is not in $\ZZ_p[x]$.
Remark: An instructive example with $f_0 \not\in \ZZ_p$ is to take $p=2$ and $f(x) = 2 x^2 + 1/2$, so that $f(f(x)) = 8 x^4 + 4 x^2+1$. You might enjoy going through this proof and seeing why it doesn't apply to this case.
Proof: We use all the notations related to Newton polygons above. Note that the leading term of $f^{(2)}$ is $f_d^{d+1}$, so if $f_d \not\in \ZZ_p$ we are done; we therefore assume that $f_d \in \ZZ_p$.
So $v(f_0)$ and $v(f_d) \geq 0$, but (since $f \not\in \ZZ_p[x]$), there is some $j$ with $v(f_j) < 0$. Thus the Newton polygon has both a downward portion and an upward portion.
Let the slopes of the Newton polygon be $s_1 \leq s_2 \leq \cdots \leq s_k \leq 0 \leq s_{k+1} \leq \cdots \leq s_d$. Thus, $(k,N_k)$ is the most negative point on the Newton polygon; we abbreviate $N_k = -b$ and $N_d = a$.
Let $\theta_1$, ..., $\theta_d$ be the roots of $f$, numbered so that $v(\theta_j) = - s_j$.
We have $f(x) = f_d \prod_j (x-\theta_j)$ and so $f^{(2)}(x) = f_d \prod_j (f(x) - \theta_j)$. We will compute (part of) the Newton polygon of $f^{(2)}$ by merging the slopes of the Newton polygons of the polynomials $f(x) - \theta_j$, as in Fact 1.
Case 1: $1 \leq j \leq k$. Then $v(\theta_j) = - s_j \geq 0$. Using our assumption that $f_0 \in \ZZ_p$, the constant term of $f(x) - \theta_j$ has valuation $\geq 0$. Therefore, the upward sloping parts of the Newton polygons of $f(x)$ and of $f(x) - \theta_j$ are the same, so the list of slopes of Newton polygon of $f(x) - \theta_j$ ends with $(s_{k+1}, s_{k+2}, \ldots, s_d)$. Thus, the height change of the Newton polygon from its most negative point to the right end is $s_{k+1} + s_{k+2} + \cdots + s_d = a+b$.
Case 2: $k+1 \leq j \leq d$. Then $v(\theta_j) < 0$, so the left hand point of the Newton polygon of $f(x) - \theta_j$ is $(0, v(\theta_j)) = (0, -s_j)$, and the right hand point is $(d, v(f_d)) = (d, a)$. We see that the total height change over the entire Newton polygon is $a+s_j$ and thus the height change of the Newton polygon from its most negative point to the right end is $\geq a+s_j$.
The right hand side of the Newton polygon of $f^{(2)}$ is at height $v(f_d^{d+1}) = (d+1) a$. Since we shuffle the slopes of the factors together (Fact 1), the Newton polygon of $f^{(2)}$ drops down from its right endpoint by the sum of the height drops of all the factors. So the lowest point of the Newton polygon of $f^{(2)}$ is at least as negative as
$$(d+1) a - k(a+b) - \sum_{j=k+1}^d (a+s_j).$$
We now compute
$$(d+1) a - k(a+b) - \sum_{j=k+1}^d (a+s_j) = (d+1) a - k(a+b) - (d-k) a - \sum_{j=k+1}^d s_j$$
$$ = (d+1) a - k(a+b) - (d-k) a- (a+b)= -(k+1)b < 0 .$$
Since this is negative, we have shown that the Newton polygon goes below the $x$-axis, and we win. $\square$
We now use this lemma to prove the requested results.
Theorem 1: Let $g \in \QQ_p[x]$ and suppose that $g^{(2)}$ and $g^{(3)}$ are in $\ZZ_p[x]$. Then $g \in \ZZ_p[x]$.
Proof: Note that $g(g(0))$ and $g(g(g(0)))$ are in $\ZZ_p$. Put
$$f(x) = g{\big (}x+g(g(0)){\big )} - g(g(0)).$$
Then $f^{(2)}(x) = g^{(2)}{\big (} x+g(g(0)) {\big )} - g(g(0))$, so $f^{(2)}$ is in $\ZZ_p[x]$.
Also, $f(0) = g^{(3)}(0) - g^{(2)}(0) \in \ZZ_p$. So, by the contrapositive of the lemma, $f(x) \in \ZZ_p[x]$ and thus $g(x) \in \ZZ_p[x]$. $\square$
We also have the stronger version:
Theorem 2: Let $h \in \QQ_p[x]$ and suppose that $h^{(k_1)}$ and $h^{(k_2)}$ are in $\ZZ_p[x]$ for some relatively prime $k_1$ and $k_2$. Then $h \in \ZZ_p[x]$.
Proof: Since $GCD(k_1, k_2) = 1$, every sufficiently large integer $m$ is of the form $c_1 k_1 + c_2 k_2$ for $c_1$, $c_2 \geq 0$, and thus $h^{(m)}$ is in $\ZZ_p[x]$ for every sufficiently large $m$.
Suppose for the sake of contradiction that $h(x) \not\in \ZZ_p[x]$. Then there is some largest $r$ for which $h^{(r)}(x) \not\in \ZZ_p[x]$. But for this value of $r$, we have $h^{(2r)}$ and $h^{(3r)}$ in $\ZZ_p[x]$, contradicting Theorem 1. $\square$.
From this question on math.SE, I have recently learned that this question is from the 2019 Japanese Math Olympiad. (Fortunately, this question was asked in 2020.) I can't read Japanese, but if anyone is able to track down and translate the official solution; I'd be interested. Back when I was training for Olympiads in the late 90's, I remember that the Japanese solutions were always very clever and surprising.