When deleting users in system_login.py that are no longer available via CLI we do a check if the user which is being deleted is the current user (https://github.com/vyos/vyos-1x/blob/442bf37dbccbcb9f47333543742fa7aa665bb417/src/conf_mode/system_login.py#L125-L131) calling commit - this is not allowed.
This is done by evaluating SUDO_USER environment variable.
When vyos-configd is in use, the value is always forced to vyos