Should there ever be a web application that needs to run as root, it should be rewritten.
All logic requiring root privileges should be moved into a separate system service with a minimal attack surface to which the web application delegates those special tasks.