Apple - How do I run Homebrew as root?
After making your change to the script, try setting the immutable flag on brew.sh.
chflags uchg /usr/local/Homebrew/Library/Homebrew/brew.sh
I have not tested. As a general rule, I do not give root to applications whose developers are begging me not to.