I had the same problem this week when I updated my Microsoft 365 subscription, which wiped out all my IMAP accounts. I finally managed to solve the problem by deleting the “new” Outlook (installed automatically with the new subscription) and re-installing the Outlook “classic” on my PC (you can download it from the Microsoft Store).
I was then able to install my IMAP accounts in Outlook classic on my PC.
Then I went back to my Samsung Galaxy and did the same thing. It worked for me. Hope it does for you too.