Folder permissions keep changing from www-data to root

I was having the same problem with /var/run/lighttpd set owned by www-data by something instead of lighttpd user. I added it to www-data group but apparently things still don't work sometimes, so I overrided the systemd service script with systemctl edit lighttpd:

/etc/systemd/system/lighttpd.service.d/override.conf
-----------------------------------------
[Unit]
Description=Lighttpd Daemon
After=network.target

[Service]
Type=simple
ExecStartPre=/bin/mkdir -p /var/log/lighttpd
ExecStartPre=/bin/chown lighttpd:lighttpd /var/log/lighttpd
ExecStartPre=/bin/mkdir -p /var/run/lighttpd
ExecStartPre=/bin/chown lighttpd:lighttpd /var/run/lighttpd
Restart=on-failure

[Install]
WantedBy=multi-user.target