It's fixed a bit differently. The purpose of the "profile lock" feature is that admins have control over the username/mail/display name. Letting the user choose the username would circumvent this. This more so applies because when you have multiple admins, maybe one admin forgot to set the username (but they had decided by policy that they won't allow users to set usernames themselves).
Given that the profile lock is a 'dynamic' flag i.e can be set/unset at anytime, the fix we have put in place is:
username can now be set already created users with no username.
When profile lock is set, username is required when creating new users. This way it's not possible for an admin to create users without a username.
When profile lock is set, invite links of users with no username show a message to contact admin. (This message will only be seen if you had users created with no username and set the profile lock later. So, it's kinda rare)