There are many ways to generate harmonic functions.
One way is as the poster suspected by looking at functions of the form:
$$f(x) = \cos(p x) \cosh(q y) \cos( r z)$$
By direct substitution, it is easy to see
$$\nabla^2 f(x) = (q^2 - p^2 - r^2) f(x)$$
If one has choose $p, q, r$ such that $q^2 - p^2 - r^2 = 0$, e.g.
$$p = r = 1 \quad\text{ and }\quad q = \sqrt{2},$$
then we get a $f$ that is harmonic, i.e. $\displaystyle\nabla^2 f = 0$.
We can also generate polynomials that is harmonic. The simplest way is to
observe:
$$\begin{cases}
\frac{\partial^2}{\partial x^2} (x \pm iy)^n = \;\;n(n-1)(x \pm iy)^{n-2}\\
\frac{\partial^2}{\partial y^2} (x\pm iy)^n = -n(n-1)(x\pm iy)^{n-2}
\end{cases}$$
This implies $\displaystyle\quad\nabla^2 ( x \pm i y)^n = 0\quad$ and hence
$$\phi(x) = (x + iy)^n + (x - iy)^n$$
is a polynomial that is harmonic. By a orthogonal transformation of $(x,y,z)$ and through linear combinations, you can generate other polynomials of degree $n$ that is harmonic and homogenous in $(x,y,z)$.