I'd like to charge two devices with one USB charger, one requests 5V, the other 9V. I plug an USB hub (potentially an old USB 2.0 one) in the (9V capable) charger and plug the two devices in the hub. How would this be handled? Would it potentially kill the 5V device or the USB protocol somehow assures that both devices will be powered from 5V?
I plug an USB hub (potentially an old USB 2.0 one) in the (9V capable) charger
Then your device will get 5 V.
It's only able to request 9 V from the charger if it is attached directly to the charger.
And the old USB hub will not be designed to work with 9 V, since the USB 2.0 standard only allowed 5 V on the VBUS line. If somehow the device did signal to the charger to provide 9 V, it would most likely damage the hub.
In order to charge your device with 9 V, you need to connect it directly to a source that is designed to the USB Power Delivery standard or one of the earlier proprietary high power charging standards (both devices using the same standard).
I plug an USB hub (potentially an old USB 2.0 one) in the (9V capable) charger and plug the two devices in the hub. How would this be handled?
When you plug an old USB 2.0 hub into a modern charger that potentially supports higher charging/operating voltages, nothing will happen above the default +5V, simply because the old hub has no idea about any special voltages and can't signal (or "negotiate" or "request") anything. So the charger will output the default +5V safe voltage.
Now, a standard USB hub has an upstream facing port decoupled from downstream ports, which includes data lines AND power lines. And the old hub has no idea about voltage negotiating and such on its downstream ports. So if some modern device tries to request higher fast-charging voltage, it will receive no response from the hub (because the hub has no idea about any extra functionality), the device request will be simply ignored, and the power will be at default, +5V safe level.
Since the hub ports (data lines) are completely de-coupled, the device request can't possibly propagate upstream and trick the charger into high-voltage mode.
In the past of PowerDelivery specifications the power negotiations were envisioned to use VBUS (power) wire to exchange negotiation packets (at radio frequency rate). Then someone raised a concern that some old bus-powered hub can accidentally couple the downstream VBUS signal into upstream port, and vice versa, so the charging port can accidentally engage into high voltage while the hub itself can't handle more than 5.5V, and will be fried. It turned out that this possibility did exist, and that't why the Power Delivery no longer uses RF negotiation over VBUS. The only permitted protocol is over Type-C connector, over its dedicated CC channel. Alternatively the Apple and QuickCharge signatures use D+/D- wires to "negotiate" fast-charge voltages. Since D+/D- are never directly coupled in any standard USB hub, this accidental negotiations can never take place.