In my case it looks like it has something to do with the license.
The user who had the problems used a f3 license. I added an exchange license to it and now I'm able to setup the mail account in apple mail.
and yesterday another user told he had problems using apple mail. I also added a exchange license to the user, but he has not yet confirmed if the problem is solved now.
But I think think microsoft changed something on the license.
When checking in the azure admin portal I can also see that imap is disabled for f3. For exchange licenses it's enabled. So I'm not sure if this was the same before the problems arised.