Extra condition for characterization of prime ideals in quadratic number fields based on quadratic residues Exercise I.3.3 of Jürgen Neukirch's Algebraic Number Theory (link to an English version, the exercise is on page 23 of the book, page 36 of the pdf) says

Let $d$ be squarefree and $p$ a prime number not dividing $2d$. Let $\mathcal O$ be the ring of integers of $\mathbb Q(\sqrt d)$. Show that $(p)=p\mathcal O$ is a prime ideal of $\mathcal O$ if and only if the congruence $x^2\equiv d\bmod p$ has no solution.

You can find my elementary attempt below, but the purpose of this question is not primarily a solution to the exercise. I am curious about the requirement that $p$ should not divide $2d$. Now, I see that $p\neq 2$ might be necessary, since there are elements in $\mathcal O$ with a $2$ in the denominator, and for this reason I use $p\neq2$ at multiple steps of my proof.
However, I do not see a problem if $p\neq 2, p\mid d$. In that case, $0^2\equiv d\bmod p$ is always a solution, and $\sqrt d\cdot\sqrt d=d\in(p)$, but $\sqrt d\notin (p)$, so that $(p)$ is not a prime ideal, which is perfectly in line with the statement of the exercise.
Am I missing something or is my argument correct and the requirement $p\nmid d$ is unnecessary? If the latter is the case, why did Neukirch include it in the exercise? Is there maybe a short proof that does not work in this case?

For the sake of completion, here is my proof:
If $x^2\equiv d\bmod p$ is a solution to the congruence, then $$x^2-d\equiv 0\bmod p\Longrightarrow (x-\sqrt d)(x+\sqrt d)=x^2-d\in(p),$$ but $x\pm\sqrt d\notin(p)$: For if that were the case, then $$\frac{x\pm\sqrt d}{p}\in\mathcal O,$$ which is impossible considering $p\neq2$ and ${\mathcal O}=\mathbb Z[\sqrt d]$ or $\mathbb Z[\frac{1+\sqrt d}2]$. Hence $(p)$ is not a prime ideal.
Conversely, assume now that $x^2\equiv d\bmod p$ has no solution and let $\alpha,\beta\in\scriptsize\mathcal O$ such that $\alpha\beta\in(p)$. It follows that $$p^2=N(p)\mid N(\alpha\beta)=N(\alpha)N(\beta).$$ Then $p$ divides $N(\alpha)$ or $N(\beta)$, without loss we can assume $p|N(\alpha)$. Put $\alpha=\frac{a+b\sqrt d}{2},a,b\in\mathbb Z,a\equiv b\bmod 2$. (If $d\not\equiv 1\bmod 4$, we additionally have to require that $a$ and $b$ are even.) Then $p$ divides $4N(\alpha)=a^2-b^2d$. If we had $b\not\equiv 0\bmod p$, then $b$ would be invertible $\bmod p$ and $(ab^{-1})^2\equiv d\bmod p$, contradicting the assumption. Thus $p|b$ and then also $p|a$. Since $p\neq2$, we still have $\frac ap\equiv\frac bp\bmod2$, so that $\frac\alpha p\in\scriptsize\mathcal O$, i.e. $\alpha\in(p)$. Therefore, $(p)$ is a prime ideal. $\square$
 A: If $p$ does not divide $2d$, then it is unramified in the extension. The case of $p=2$ in quadratic extensions is anomalous.
For $p$ unramified in a quadratic extension $\mathbb Q(\sqrt{d})$ with square-free $d$ of $\mathbb Q$, since the ring of integers is locally-at-$p$ obtained as $\mathbb Z[\sqrt{d}]$. Then (I think Dedekind knew this) the splitting of $p$ in the extension is described by the splitting (or not) of $x^2-d$ over $\mathbb F_p$.
So, the $p$ not dividing $2d$ hypothesis is just to avoid $2$ and to avoid ramified primes.
EDIT: ah, yes, to respond more precisely to the actual question, as @ThomasAndrews comments, the assertion that $p\not=2$ stays prime if and only if $x^2-d$ has no solution mod $p$ is correct also for $p|d$. It's just that "$p$ ramified" is has some technical differences from "$p$ split"... and, since only finitely-many primes ramify in a given finite extension, sometimes it's easier to exclude ramified primes (even if something analogous is true for them).
