Ehrenfest Theorem and boundary Conditions

The reason for your conflicting results has to do with the subtleties of hermiticity on finite intervals.

Look carefully at the formal steps in the derivation of the Ehrenfest theorem: $$ \frac{d}{dt} \langle \psi(t) | x |\psi(t)\rangle = \langle \frac{d\psi}{dt} | x |\psi\rangle + \langle \psi | x |\frac{d\psi}{dt}\rangle = \frac{i}{\hbar} \left[ \langle H\psi | x|\psi\rangle - \langle \psi | x H |\psi\rangle\right] $$ Usually at this point one makes use of the hermiticity of $H$ and proceeds to rearrange the first term so as to obtain $$ \frac{i}{\hbar} \left[ \langle H\psi | x|\psi\rangle - \langle \psi | x H |\psi\rangle\right] = \frac{i}{\hbar} \langle \psi | [H, x] |\psi\rangle = …= \frac{1}{m} \langle \psi | p |\psi\rangle $$ And it is no problem to check that $H$ is indeed hermitic.

Here's the catch however: in this particular case it is hermitic on the space of functions periodic on $[0,L]$. But let us look closer at $$ \langle H\psi \;|\; x\;|\;\psi\rangle \equiv \langle H\psi \;|\; x\psi\rangle = \langle x\psi \;| \;H\psi\rangle^* $$ It is the matrix element of $H$ between one periodic function, $\psi$, and one that is no longer periodic, $x\psi$, which falls outside its proper domain. For this combo $H$ is no longer hermitic, as we can easily check by direct calculation: $$ \langle H\psi \;|\; x\psi\rangle \sim - \int_0^L{dx\; \frac{d^2\psi^*}{dx^2} x \psi} = - \int_0^L{dx\; \frac{d}{dx}\left(\frac{d\psi^*}{dx} x \psi\right)} + \int_0^L{dx\; \frac{d\psi^*}{dx} \frac{d}{dx}\left(x\psi\right)} = \\ = - \frac{d\psi^*}{dx} x \psi \big|_0^L + \int_0^L{dx\; \frac{d}{dx} \left[\psi^* \frac{d}{dx}(x\psi)\right]} - \int_0^L{dx\; \psi^*\frac{d^2}{dx^2}\left( x \psi\right) } = $$ $$ = \left[ \psi^* x \frac{d\psi}{dx} - \frac{d\psi^*}{dx} x \psi \right] \big|_0^L - \int_0^L{dx\; \psi^*\frac{d^2}{dx^2}\left( x \psi\right) } $$ where the first term on the last line was simplified based on the periodicity of $\psi$. But in what is left of it, the presence of $x$ spoils the periodicity and it no longer vanishes as one would naively hope.

Compare to the case when $\psi$ vanishes on the boundary, as for a particle in an infinite box: the boundary term disappears, or in other words, $x\psi$ is still in the domain of $H$ and the theorem is fine.

For a more or less clear answer to all this, that actually goes further (turns out that the extra non-Hermitian terms have their own life - follow well-defined patterns) see

Konstantinou, et al. “Emergent Non-Hermitian Contributions to the Ehrenfest and Hellmann-Feynman Theorems.” [1402.1128] Long Short-Term Memory Based Recurrent Neural Network Architectures for Large Vocabulary Speech Recognition, 10 July 2016,