Material driver works, but doesn't update in viewport
After a long time fiddling with drivers and properties, I found a solution.


Create a custom property for the material you're manipulating with drivers





Add a driver to the property, and add your variables and scripted expressions to this driver





Reference the custom property in your node driver




Important: The intermediate custom property must be a material property. Custom object properties alone won't work.

Possibly related: Driver on material not updating.
Mainly the "not all drivers are created equal" statement. The issue I experienced is the inverse of what happened in this question, though.

For some strange reason, the existence of a custom material property with the script is what triggers the auto update. If you have two identical drivers with the script, one for a custom object property, another for a custom material property, and reference the object one, it'll work. As long there's an identical material driver doing the calculation, it'll work. You don't even need to reference it, it only needs to exist. Don't ask me why.