Query all Identities for Username Generation?

Did you ever figure out a solve for this? I have the exact same situation as you right now (same pattern and problem).