Optimize flattener by trying to reduce a TF before reducing its args.

This has a demonstrated 2x speed boost on the T9872{a,b,c} tests.
(#9872)