Mix node as identity function
This is because you are using a Mix shader (Add node > Shader > Mix).

This does not work because:


A color output (yellow socket) is not a valid shader input (green socket).
A shader output (green socket) is not a valid value input (gray socket)


If you instead use a Mix RGB node (Add node > Color > MixRGB), it will work as expected: