How do I get the chest in World 4-5?

Solution 1:

Apparently, there are multiple solutions to this puzzle. The game was glitched for that other permutation, but not for others. If I rotated red one more time, an alternate path will be made and I can enter this pipe (and go back).

working path it works