tweak: only recast if original f was Poly
tweak: only recast if original f was Poly

If the original f was not a Poly then there is not need for
recasting since p is already made without explicit generators.
kaushik94/sympy,kaushik94/sympy,kaushik94/sympy