I figured it out. You can't move into the derivative operator directly. It turns out that if you differentiate the RHS of the second equation that some terms cancel out and you end up with the RHS of the first equation. I didn't miss anything fundamental and magical.