When empty minecart derails from east-west tracks (to clarify: stars goes from left to right - tracks goes forward) it turns about 75* toward magnetic south (sunset direction). When Player enters minecart and start moving along same track, his head turns 45* toward opposite - magnetic north (sunrise) direction, and carts with player after derailment turns 45* to south.
On south-north tracks minecart derails with no rotation, and player head not turns when cart is starting.
Because of similar angle and conditions, this bugs are related - it looks like minecart on west-east track is "internally" rotated, and player head is counteracts to this.
P.S. Minecart rotates after derailment only in there were no turns on the way (like if turning resets or at least decreases carts "internal rotation").