Suppose $\langle\phi|\psi\rangle = re^{i\theta}$. As you have noticed, if we have access to multiple copies of the state, then we can measure $r$ using the SWAP test. Now, consider the state $|\psi'\rangle = e^{-i\theta}|\psi\rangle$ and note that
$$
\langle\phi|\psi'\rangle = e^{-i\theta}\langle\phi|\psi\rangle = e^{-i\theta}re^{i\theta} = r.
$$
Since $|\psi'\rangle$ and $|\psi\rangle$ differ only by the global phase, we see that a quantum circuit computing $re^{i\theta}$ would let us observe the global phase difference between $|\psi\rangle$ and $|\psi'\rangle$ which is unobservable. We conclude that such a quantum circuit does not exist. All we have observational access to is the magnitude of the inner product $\langle\phi|\psi\rangle$.
For two $n$-qubit computational basis states $|x\rangle$ and $|y\rangle$, the CZ-based quantum circuit computes
$$
(-1)^{x \cdot y}|x\rangle|y\rangle,\tag1
$$
where $x\cdot y=\sum_{i=1}^n x_iy_i$ is the inner product between binary vectors $x=(x_1,\dots,x_n)$ and $y=(y_1,\dots,y_n)$. The inner product $\cdot$ is defined in the vector space $\mathbb{Z}_2^n$ of binary strings on $n$ bits and is a different inner product than $\langle \,.|\,.\rangle$ defined in the Hilbert space.
Note that the circuit does work for states other than computational basis states by linear extension. In fact, its only action on a computational basis is to change the unobservable global phase, so it is only useful on states that are superpositions of computational basis states where its effect is to change the relative phases according to the $\mathbb{Z}_2^n$ inner product of the states.
In any case, the circuit does not compute $\langle\phi|\psi\rangle$.