reinstall: don't build bottles unnecessarily.
reinstall: don't build bottles unnecessarily.

Apply the same changes from #6066.

Also apply the same logics from `brew upgrade` to preserve
`installed_as_dependency`/`installed_on_request` settings
when reinstalling formulae.

JCount/brew,EricFromCanada/brew,JCount/brew,JCount/brew,nandub/brew,vitorgalvao/brew,Homebrew/brew,vitorgalvao/brew,nandub/brew,MikeMcQuaid/brew,mahori/brew,nandub/brew,EricFromCanada/brew,sjackman/homebrew,konqui/brew,EricFromCanada/brew,konqui/brew,Homebrew/brew,claui/brew,Homebrew/brew,reitermarkus/brew,claui/brew,sjackman/homebrew,reitermarkus/brew,JCount/brew,mahori/brew,EricFromCanada/brew,konqui/brew,vitorgalvao/brew,MikeMcQuaid/brew,mahori/brew,vitorgalvao/brew,MikeMcQuaid/brew,claui/brew,Homebrew/brew,konqui/brew,reitermarkus/brew,sjackman/homebrew,sjackman/homebrew,reitermarkus/brew,claui/brew,MikeMcQuaid/brew,nandub/brew,mahori/brew