update: untap/retap formulae before/after pull.

This should fix problems like #19799 where we pull formulae from taps into
core. I want to get something similar merged ASAP so we can pull GCC into core
(see #20678).

Closes #19799.