I had a similar issue with an old backup script (.bat) I'd used on a domain server for years. After I "upgraded" to Server 2016, I noticed that xcopy /m was no longer clearing the archive bit. I turned out that the account I was using to run the script in Task Scheduler was not running with Administrator privilege. This privilege was not previously required in order to clear the bit, but it is now. I had to add the account to the Administrators group, and then in Task Scheduler, I had to check the box "Run with the highest privileges" on the task setting. The archive bits are now being cleared with xcopy /m.
On Windows 11, when using attrib in a console window, you must first open the console with "Run as Administrator" before it will clear the bit.