If you apply the Wirtinger derivative $\frac{\partial}{\partial \overline{z}}$ on both sides of $r=|f|^2+|g|^2=f\overline{f}+g\overline{g}$ you get $$f\overline{f'}+g\overline{g'}=0$$
where you need to take into account the product rule and Cauchy-Riemann equations: $\frac{\partial}{\partial \overline{z}}f=\frac{\partial}{\partial \overline{z}}g=0$
Therefore, $-\frac{f}{g}=\frac{\overline{g'}}{\overline{f'}}$
The left hand side is analytic, where $g\neq0$, and the right hand side is anti-analytic, when $f'\neq0$. Therefore, at all those points both of those quotients are constant.
If $f$ is a constant multiple of $g$, then $|f|^2$ is constant.