FormulaInstaller: split up big method
FormulaInstaller: fix "optional build-time dep" edge case

An "optional build-time dep" is unlikely, but possible, and I happen to
notice this wasn't handled correctly while digging around in the deps
code over the last few days.