In general, given any two functions $p$ and $q$. If $p \circ q$ is injective, so does $q$.
Since the identity map $z \mapsto z$ is injective. The condition $g(g(f(z))) = z$ implies $f$ is injective. Since $f$ is holomorphic, $f(z)$ is a linear function, i.e. $f(z) = az + b$ with $a \ne 0$.
Now $g\circ g = f^{-1}$ is injective, so $g$ is also injective. This force $g(z)$ to be a linear function too, i.e. $g(z) = cz + d$ with $c \ne 0$.
Substitute this into the condition $g(g(f(z)) = z$, we can express $f(z)$ in terms of $c,d$.
$$f(z) = \frac{x}{c^2} - \frac{(c+1)d}{c^2}$$
$f(z)$ has a unique root at $z = (c+1)d$, In order for
$\prod\limits_{f(z) = 0}g(z) = 1$, this forces $d = \frac{1}{c^2+c+1}$.
As a result,
$$f(z) = \frac{x}{c^2}-\frac{c+1}{c^2(c^2+c+1)},\quad
g(z) = cx + \frac{1}{c^2+c+1}$$
is one family of solutions for the problem.