Revert "brew: use a shell wrapper script for brew"

This reverts commit 225546a3ee2d3f22e185e47d4db6f6716a56669b.
Revert "brew: move to Library/brew.rb"

This reverts commit 67d06b84d00a17cf43770eedf34e37e50e209741.

Closes #17683.
Closes #17685.