In Intune, the Primary User is the original user who enrolled the laptop. It can be changed manually or through PowerShell, but there is no built-in mechanism to change it based on login data like SCCM can with user-device affinity.
If someone is using a machine but is not assigned as the Primary User, self-service features in Company Portal will not work, including the ability to install applications.
As a workaround, you can remove the Primary User assignment and set it to no one. However, doing this removes the option to uninstall applications through Company Portal.
Recast should be able to have a workflow that checks the event viewer logs and based on those logs it can set the primary user in Intune.