For the sync between the HR system and the local AD we use an on-prem SQL database that can be connected to Flow via a Data Gateway. In this database there is the Middle Name field available that I will use to sync it to Dynamics 365.
Overview of the flow:
For each user the local SQL database is queried:
When the Middle Name value from the database is not equal to the Middle Name in Dynamics 365, then I update the user record: