DynamicExpressions supports ChainRules starting v0.17 SymbolicML/DynamicExpressions.jl#71. We can remove parts of our code with CRC.rrule_via_ad. We still need to define a rule because we do an in-place node update. Additionally we need to extract the node parameters in the final parameter gradient.