Well, then ... do a 2 step ... restore to the system that works, backup again, take it to other server and see what happens!
Could do above via command line. Yeah, 500+ courses is a lot but ... we might have to do what we need to do if it's just a few courses.
I no longer run 3.x's but you might investigate if all the tables on the troubled system are utf8mb4 with collation utf8mb4_unicode_ci via script in code/admin/cli/
Reason I suggest this ... can remember many moons ago some systems that weren't 100% compliant with above having issues the the mnethostid column.
Using mysql client what does an explain on mdl_user table show?
Doctoring the extracted users.xml file and then re-inserting into .mbz file would be tricky ... but could be done ... i've had to do that with a troubled course. The trick, me thinks, is inserting the mnethostid tags in the right sequence.
'SoS', Ken