Guys, while I don't have an X5 or X7 (yet
), I do have a '17 M3 and I also have this same high pitch whine that you are referring to. I usually only hear it when the ignition is on, but the engine is off. I noticed it when I purchased my M3 2 yrs ago.
I think what you are hearing is just electronics noise from the car. The electronics and electrical relay systems in these cars are very complex and installed in tight spaces so it is no wonder you will hear some electronics noise. If you were to put your ear up close to some of the modern electronics in your house like tuners, TVs, cable boxes, etc, you would also be able to hear some electronics "whine" as well. Unless there is something wrong with the car, I think your car is fine and the dealer will tell you the same if you take it in.
In fact, if the electronics in the G05/07 is similar to the F80, you can "manually" turn on some electronics in the car that cause that whine. When your car is completely off after several minutes (and left unlocked), enter your car (with your key on you) and press the gas pedal. Opening the door will "wake up" the car, but I noticed pressing the gas pedal with the engine off wakes up a few more circuits that can contribute to the electronics whine you are hearing.
But bottom line, I would not worry about it...