I'm stuck at page 37 of the (second ed.) of "Microelectronics" by Millman & Grabel, section "1-7 Graded Semiconductors". Before that section, it spent some time explaining the phenomenon of diffusion and the diffusion current for holes and electrons, the Einstein relationship and the total current. The total current is, separating the terms corresponding to holes ($p$) and electrons ($n$)
$$ J_p = q \mu_p p \mathscr{E} - q D_p \frac{\text{d} p}{\text{d} x} \\ J_n = q \mu_n n \mathscr{E} + q D_n \frac{\text{d} n}{\text{d} x} $$
where $\mu$ is the mobility, $\mathscr{E}$ the electric field, $D$ the diffusion constant and $p$ ($n$) the concentration of holes (electrons). So far so good. I copy the beginning of the section I can't understand here
"The semiconductor sample shown in Fig. 1-10a has a hole concentration that is a function of $x$; that is, the doping is graded (non-uniform). The electron density must also vary with $x$, a consequence of the mass-action law. Let us assume thermal equilibrium and that no carriers are injected into the sample from any external (zero excitation). Under these conditions there can be no steady charge motion, only the random motion due to thermal agitation. Hence the total hole current must be zero; also, the total electron current is zero. Since $p$ is not constant, we expect a nonzero hole diffusion current. For the total hole current to vanish, a hole drift current must exist which is equal and opposite to the diffusion current. However, a conduction current requires and electric field, and we conclude that, as a result of the nonuniform doping, an electric field is generated within the semiconductor."
I really can't get a physical intuition of why there must be a hole drift current equal and opposite to the diffusion current. Mathematically is pretty clear ($J_p=0$ and solving for $\mathscr{E}$). Physically, I imagine holes moving in the valence band preferably in the direction of positive $x$ due to statistical reasons, but I can't see the opposite drift current happening.
I can't also understand the premises. The reasoning here is something like "the total current is zero hence there must be an electric field". I can't even see why the total current must be zero. In my mind, if the concentration of holes is nonuniform, there must be a diffusion current and that's it, so the total current is not zero: the total current is the diffusion current.