Changing node structure during an animation
You could create the two node setups you need. (the two versions) and use a Mix node to mix from one setup to the other. You can keyframe the factor to do that automatically.