Does that mean that it is risky to have USB devices which
are powered from mains because they could theoretically
fail and apply mains to the hub, take it out, and in turn
apply mains to the other devices' USB receivers?
Yes, of course. Which is why powered USB hubs are almost always supplied from a separate power supply unit, which is manufactured by a specialist company, meeting strict electrical standards for safe operation and isolation from the mains. And for the same reason desktop computers are almost always built with the PSU unit as a physically isolated component.
The risk of the separate power supply unit failing and taking out the USB hub and everything attached to it is quite low, because those power supply units are designed, manufactured, tested and certified to not do so even under normal failure conditions.
The same care is taken when mains power supply is integrated into any device: the risk exists, so the device must be carefully designed to contain that risk. A computer where a simple component failure could connect mains power to an audio jack would never get type approval for sale to the retail/home market.
But this is not true for things not directly connected to the mains. Speakers and ordinary 5V USB devices aren't directly connected to the mains, and don't have that kind of protection. If one goes, it may take out anything it is connected to.
It used to be all too common for an audio amplifier to fail and destroy your speakers, or for a speaker to fail and destroy your audio amplifier. It probably still happens, but if your phone fails you just throw it away without even looking inside.