Brew is broken by design - it installs programs in /usr/local without requiring root permissions. You cannot in fact run it as root, it won’t let you.
I’ll wait for the home brew maintainers to tell me I’m wrong and that their approach is perfectly fine, despite being at odds with the standards set by every commercial and open source operating system on the planet.
I don't know about brew and the MacOS ecosystem.