The usage of Nullstellensatz-like results should be more subtle here. A similar idea was discussed in a recent question: https://mathoverflow.net/questions/469029/a-version-of-hilberts-nullstellensatz-for-real-zeros. A solution based on this for the case where $f:\Bbb{C}^n\rightarrow\Bbb{C}$ is a polynomial: The real polynomial $Q(x_1,\dots,x_n)=x_1^2+\dots+x_n^2-1$ is irreducible when $n\geq 2$ (nothing to prove when $n=1$). Its zero-locus in $\Bbb{R}^n$ is a submanifold of dimension $n-1$. Any polynomial $f\in\Bbb{C}[z_1,\dots,z_n]$ that vanishes on the real zero locus must be divisible by $Q$ (this is the content of the question I linked). In particular, $f$ is zero on the locus $\{(z_1,\dots,z_n)\in\Bbb{C}^n\mid z_1^2+\dots+z_n^2-1=0\}$.