t, f = hyper_as_trig(e) should preserve the invariant f(t) = e

This was not the case for constant expressions, see #7761.
Closes #7761.