I've stumbled upon this issue after upgrading to bookworm. In my case the timeout was both due to pam_mount and Roland's missing session environment case. Fixed both by replacing `su` invocation with:
runuser -p -l -u "$NR_USERNAME" -- "$NSEND" -a needrestart -u critical -i dialog-warning "$MSGTITLE" "$MSGBODY" -- Michał Mirosław