tl; dr: Yes.
Proposition: If $g$ is continuous and periodic, and if there is an integer $n > 1$ such that the function $h(x) = g(x^{n})$ is periodic, then $g$ is constant.
Here's a proof that (perhaps unfortunately) relies on concepts and results from real analysis: A continuous, periodic function on the reals is uniformly continuous on the reals.
Proof: It suffices to prove the contrapositive, i.e., if $g$ is continuous, periodic, and non-constant, and $n > 1$, then $h(x) = g(x^{n})$ is not periodic.
Assume $g$ is non-constant, let $\ell$ denote the smallest positive period of $g$, and consider the intervals $[(k\ell)^{1/n}, ((k+1)\ell)^{1/n}]$ for $k$ a positive integer, which map to the period intervals $[k\ell, (k+1)\ell]$ under $x \mapsto x^{n}$. Intuitively, the length of these intervals decreases to $0$ as $k$ grows without bound, but "$h$ goes through a complete period of $g$ on each", so $h$ is not periodic unless $g$ is constant.
Rigorously, if $g$ is not constant, there exist points $a$ and $b$ in $[0, \ell]$ such that $g(a) < g(b)$. It follows that for each positive integer $k$, there exist points $a_{k}$ and $b_{k}$ in $[(k\ell)^{1/n}, ((k+1)\ell)^{1/n}]$ such that $h(a_{k}) = g(a)$ and $h(b_{k}) = g(b)$. Since the difference $|h(b_{k}) - h(a_{k})|$ is independent of $k$ but $|b_{k} - a_{k}|$ decreases to $0$, $h$ is not uniformly continuous, and therefore not periodic.