That sounds like a good idea! Patches welcome. Seems like quite a lot to work through.
Alternatively these uses of sudo could also be reviewed / implemented any other way so sudo can be avoided and perhaps this solution can be avoided as well.
Seems harder to do and get right. Perhaps an APT trigger.
Will out comment this for now due to breakage mentioned above.