TL;DR
Change direction of pipes when put down from automatic to manual.What ?
Instead of having pipes direction handled automatically, I suggest that pipes could have a direction, but no orientation. Long story short, you could either place north-south pipes or east-west, then the same logic that handle belt would change the direction of the soon-to-be-placed pipe: