Hi Frank,
In a Directory Synchronization environment, generally, we have an official solution called SMTP matchingto match on-premises user accounts to Office 365 user accounts, which can match the corresponding user accounts according to the SMTP addresses.
Please refer to How to use SMTP matching to match on-premises user accounts to Office 365 user accounts for directory synchronization, and pay attention to SMTP matching limitationsunder the MORE INFORMATIONsection.
If I’ve misunderstood anything about your current situation (and if the SMTP matching doesn’t meet your requirement due to my misunderstanding), please just get back and let me know.
Thanks,
Allen