The class ProductTree and the function prod_with_derivative() were introduced in #34303. Both are fully generic in principle, but they remained in hom_velusqrt.py in the heat of the moment.
We should move them to a more suitable place; it seems sage.rings.generic is an appropriate choice. Slight tweaks to ProductTree while we're at it.
CC: @jhpalmieri
Component: algebra
Author: Lorenz Panny
Branch/Commit: c3dcb9b
Reviewer: Kwankyu Lee
Issue created by migration from https://trac.sagemath.org/ticket/34791