It's difficult to say what went wrong.
Depending on which order you did what, it's possible a cache clear is required (php flarum cache:clear).
You usually don't need to disable extensions before running composer commands. But it's also true it shouldn't cause an error to do so.
Did the error start appearing before you ran any composer command ? If so there's likely something wrong with either of those extensions that might require a fix.
I can't try reproducing right now but if you are able to find a reliable way to reproduce it, please post the steps here so someone can take a look.