As you've already discovered, configuring Mutt for a single IMAP server requires setting up several variables. Changing to a different IMAP server would require changing those variables. Doing that from within a running Mutt session is possible, but I could see it being very brittle and prone to error.
One possibility is to create separate .muttrc files, one for each IMAP server you want to talk to. When you want to start a session with a given server, you'd say "mutt -F IMAPserver1.rc" (or some such). The downside of course is that you'd have to quit Mutt every time you wanted to switch servers. (Alternatively, you could launch several copies of mutt, one per terminal console, each connected to a different server.)
That said, despite the fact that Mutt can function as an IMAP client, it isn't a very good one. And I say that as a decades-long Mutt user.