Move head-only checks to cmd/install

Fixes https://github.com/Homebrew/homebrew/issues/30084

These checks should only apply to formulae explicitly given to `brew install`, and not block installation of dependencies that happen to be head-only.