The synchronisation of the Mendix very advanced and can handle most cases, but you managed to find one which is not doable. Internally the tables have a guid (uniqure code) and that guid is also in the data. If you delete a module and import it, you get new a guid, but the name is the same. The data can not be updated.
Locally it worked probably because you started the model after deleting the module and before importing B.
You can do that on the server with deploying after deleting module A, start the cloud, import the module and deploy.
BTW: your data will be lost. If you want to keep the data, modify the current module or give the name the new module another name and make conversion microflows.