When you migrated your mail from an on-premise Exchange to Office 365, and you did not (yet) uninstall Exchange and/or clean up AD, Outlook will still try to configure itself to connect to the on-premise Exchange when adding a new account, even though Autodiscover has been configured correctly (autodiscover.domain.tld pointing to autodiscover.outlook.com).
The reason for this is in the way how Outlook performs its autodiscovery attempts. The first step in the discovery process is trying to configure the account using Service Connection Point (SCP), which is defined in AD (or in rare cases, in the registry of the computer). As the SCP is still configured in AD/registry, Outlook will use those settings to configure the account. Only when SCP fails will Outlook move on to discovery using autodiscover CNAME records.
To circumvent the issue without having to unconfigure SCP in AD or uninstall the local Exchange, you can tell Outlook not to use SCP to configure accounts. This is done through the registry, and can be applied in a Windows domain with a GPO.
After the change has been made, Outlook will no longer use SCP to try and configure the account. Instead, it will move on to performing configuration using Autodiscover CNAME records.