Build bash with SSH_SOURCE_BASHRC, like Apple does.

Apple's /bin/bash is built with SSH_SOURCE_BASHRC, which causes
~/.bashrc to get sourced when the shell is run non-interactively over or
sshd/rshd.  Linux distros usually also build with SSH_SOURCE_BASHRC (at
least, Debian does).  This makes Homebrew do the same.

MacPorts has a similar issue, so you can find more details here: https://trac.macports.org/ticket/40603