Whether you've rooted your device or not and/or use a custom ROM or not (flashing a stock ROM does not require rooting, flashing a custom ROM typically does require a rooted device as part of the process), it's not just Google's data mining you need to address. Your carrier will be tracking you through local cell tower connectivity and retaining records of your usage; there are countless apps from third-party developers that are data mining too (with some being explicit and up front about it, some being secretive and have been caught red-handed, and some that may or may not ever be revealed); and don't forget about the fun folk at various government agencies, like our NSA, that are collecting a massive amount of all citizen data. When you're focusing just on Google like the talking heads in the media often do, you're ignoring all the other players out there doing the same thing.
So basically, if privacy is the most important goal, there's a distinct contrast between 'privacy' and 'smartphone' and you need be very vigilant about maintaining a balance between the two. If you lock your smartphone down to a point where it's not sending/receiving any data, it's also matter where functionality and usability get nullified too.
-- Flashing a phone with its stock ROM does not require rooting but with most phones flashing a custom ROM does require it as part of the install process.
-- Whether the manufacturer, your carrier, or Google are aware of your phone being rooted or not isn't something they can prevent you from doing. Your phone is
your property. A lot of people confuse things like Terms of Service agreements to be equal to violating some kind of municipal law but if you don't adhere to some point in the ToS it's not like they can actively have law enforcement take you away. A ToS is NOT a law, it is NOT something that you can be taken to a court of law over. So while they can't actively keep you from rooting your device, they can make things less convenient for you on their ends. OTA updates and OTA version upgrades are more problematic on rooted devices and need to be applied manually, also some apps, like Netflix, Pokemon Go, some financial services, have a mix of issues -- i.e. The Netflix app needs to be sideloaded as it won't install from the Play Store on a rooted device, although once installed it will function normally. Some banking apps just won't work on a rooted device. And in some cases you can use something like Magisk to allow an otherwise non-root-only app to run on a rooted device. But that mix of issues that depend on what device you have and what version of Android its running. YMMV.
https://www.xda-developers.com/how-to-use-magisk/