Just like how krastorio2 handled their roboports(pressing a hotkey would change the roboport state between normal, construction only and logistic only, but what's really behind the scene is a custom script is switching the roboport to a custom hidden entity that have no logistic/construction range), I think a way to make the mod even simpler is to hide all underground pipe items but the 4-way one, and create 4 custom hotkeys(like Shift + I,J,K,L) to toggle whether each side of the pipe is connectable or not, by switching between different entities. There should also be custom handling to make sure robots can construct any pipe section with the 4-way one, and returns a 4-way pipe when any pipe section is deconstructed. My runtime scripting skill is not very good so if anyone can figure this out and is interested please give this a try.