First the normal mode was changed, then the custom normal input was evaluated. That's incorrect because changing the normal mode changes the output of the normal mode. The fix is to avoid changing the normal mode until after the normals are calculated.