Hi Salahuddin,
According to your description, I understand that you want to create users with custom domain and sync them to Office 365 automatically.
Every time user's SMTP address is @company.onmicrosoft.com because the user's UPN suffix cannot be recognized by Office 365.
Here are two scenarios:
1. The user's email address is user@domain.local. If the on-premises domain is a local domain and cannot be resolved from the Internet, the user account will be synced to Office 365 with @company.onmicrosoft.com by default.
2. The user's email address is user@domain.com. Please confirm that the domain.com (and all child domains) has been added and verified in Office 365.
Thanks,
Bourne Zhang