DM-13065 adds a new low-level polynomials library to afw::math, incorporating but heavily modifying code from afw.math.ChebyshevBoundedField, meas.astrom.PolynomialTransform, and shapelet.
The new, unused, not-quite-working TAN-SIP fitter code should be rewritten on top of this new library. It should be possible to remove a lot of duplicate code.
It might also make more sense to rework this as a TAN+Chebyshev fitter whose results can be transformed to SIP for FITS-friendly persistence (while keeping our internal representation in Chebyshev). This should be similarly easy with the new polynomials library, and should be much more robust.