problems with an IMAP account with folders both inside and outside of Inbox

I was trying to help someone with his email and it turned out that he has subfolders both inside the Inbox and outside/next to Inbox. Moreover, most of these folders have the same name both places (though not the same content), suggesting that the directories got duplicated at some point.

This structure works correctly in both Thunderbird and Outlook, but not in Mail on his iPhone – it shows all folders at the same level, resulting in many folder doubles. Moreover, it shows the folder pairs as having the same content, even if they actually include different messages.

The email is hosted by his ISP provider, i.e., not one of the big/standard email providers.

What is the best way to fix this? I am considering trying to merge the double folder, but don’t know whether it is better/safer to have them inside or outside of Inbox.
Is the iOS Mail known to have problems with either variant?