A cloud-based identity and access management service for securing user authentication and resource access
ExO mailboxes are tied in to the corresponding Entra user objects, so as long as you don't make any breaking changes on that front, everything will be fine. Stopping dirsync will indeed convert the users to cloud-only, and allow you to "fully" manage them via the Entra/M365 tools. The associated mailbox will not be affected in any way during this process, and as long as a license remains assigned to it.
As a hint, if you put the mailboxes on hold, be it "classic" litigation hold or as part of Purview retention policies, even in the event of deleting the user object, the mailbox will be preserved as the so-called "inactive" mailbox. Generally speaking, there should be no need to go that route just for the sake of the "disable dirsync" scenario, I only mention it as a method to doubly ensure your piece of mind.