Yep, do this OP... don't try to hack in some automated script that now has a race condition with device setup. udev has a ton of hooks for enabling, disabling and doing anything when device state changes.
Look into NOPASSWD in the sudoers manpage. You can just put the code in a script then give %wheel (or whomever) NOPASSWD access to run it. This can also be thrown in sudoers.d for ease of copying and managing config across machines.
Is there a way to automate this as a shell script without having to type the password?
I assume
Sudo -s | password | unbind string but that doesn't work.