@Michal Zyzak , For Autopilot profile, it is downloaded before the device is enrolled into Intune. And the domain join profile is received before user get the login page. And the device group is only supported during these profile assignment.
https://learn.microsoft.com/en-us/mem/autopilot/windows-autopilot-hybrid#create-and-assign-an-autopilot-deployment-profile
Here is a link describe the process of Autopilot Hybrid Azure AD join for your reference:
https://oofhours.com/2020/06/23/windows-autopilot-user-driven-hybrid-azure-ad-join-over-the-internet-using-a-vpn/
Note: Non-Microsoft link, just for the reference.
For our situation, we can assign different Group tag to the devices in different domains when register Autopilot devices. Then create different dynamic groups according to the group tag. Group Tag field maps to the OrderID attribute on Azure AD devices. If you want to create a group that includes all of your Autopilot devices with a specific Group Tag (OrderID), type: (device.devicePhysicalIds -any _ -eq "[OrderID]:179887111881"). We can see more details in the first article we provided.
Then we can assign different Autopilot profiles and domain profiles to the specific dynamic group to make them work well.
Hope it can help.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.