brew-leaves: resolve dependency graph for installed formulae only

Closes #19870.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
brew-leaves: use Formula.installed