I cannot seem to find the derivation of the maximum of the univariate Gaussian distribution on stack exchange. For this reason I will attempt my own derivation. Please let me know if you find any mistakes:
Gaussian distribution:
$\frac{1}{\sqrt{2\pi\sigma^2}} \exp(-\frac{1}{2\sigma^{2}}(x-\mu)^2)$
$\frac{dy}{dx}= \frac{1}{\sqrt{2\pi\sigma^2}} (-1)\frac{2}{2\sigma^2}(x-\mu) \exp(-\frac{1}{2\sigma^{2}}(x-\mu)^2) = 0$
Where $(-1)\frac{2}{2\sigma^2}(x-\mu)$ is $\frac{dy}{dx} (-\frac{1}{2\sigma^{2}}(x-\mu)^2)$
As $\sigma^2$ cannot be 0 (it is in the denominator) we know that both $\frac{1}{\sqrt{2\pi\sigma^2}}$ and $\frac{2}{2\sigma^2}$ cannot be 0. Therefore we can remove them. We are left with:
$\frac{dy}{dx}= -1(x-\mu) \exp(-\frac{1}{2\sigma^{2}}(x-\mu)^2) = (-x+\mu) \exp(-\frac{1}{2\sigma^{2}}(x-\mu)^2) = 0$
As an exponential cannot be 0, $(-x+\mu)$ must be 0. Therefore $x=\mu$. Hence the maximum of a gaussian is attained at $x=\mu$
Your analysis is incomplete because you don't actually show that a maximum is attained at $x = \mu$, just that it is a stationary point. If you want to make your life a bit easier, as the exponential is a strictly increasing function, its maxima and minima will be attained at the same points as the exponent. This means that you can simply search for the maxima of $g(x)= -\frac{1}{2 \sigma^2} (x-\mu)^2$.