Tankless sub-panel water heater use = buzzing?
Could be several things, among them:


There is a loose neutral connection in the heater circuit or elsewhere and when high current flows to the heater, the loose neutral is causing flicker and it is causing what's called "common mode noise" (electrical noise related to ground) that is getting picked up by your sound bar.
The overall added load of your water heater is too much for the service and is causing a voltage drop, in which case you need to call the utility about making sure you are being given enough capacity (i.e. the size of their transformer).
Similar to #2, but is being caused by you have under sized conductors that are causing the voltage drop under load.


My first choice would be #1, given that it is getting picked up by the sound bar.

Is it dangerous? Possibly. Loose connections and/or voltage drops under load are never good things and will not "go away" by themselves.