I have genuinely done everything I could to fix this. I checked every relevant part of the code I could find, searched extensively online, read discussions on Reddit, and went through the official Factorio forums and other available resources. After all that research and testing, I still haven’t found a reliable way to eliminate the bug completely.
The main lesson I’ve learned from this experience is that underground belt and underground pipe behavior is an extremely sensitive part of Factorio. It is not something that can be modified safely or casually. Once that behavior breaks, it can create unpredictable problems, and even after repeated attempts, the result may still not work correctly.
I have taken this as far as I currently can, but the bug is still present, and nothing I have tried has fully resolved it. I don’t want to pretend that it is fixed when it isn’t.
Based on my personal experience, I would strongly recommend avoiding changes to underground belt and underground pipe behavior unless there is a proven and reliable solution. I may eventually remove the underground belt and underground pipe upgrade research from the mod entirely, because keeping a feature that still has an unresolved bug may cause more trouble than it is worth.