Simplify the logic and always create node outputs in the order specified by the render engine, I can't see a reason why built-in passes must be first.
Simplify the logic and always create node outputs in the order specified by the render engine, I can't see a reason why built-in passes must be first.