Hi,
The problem happens because there is still a definition deployed with the message name associated to the start event. If the message happens, how can the engine know which definition to use to start a process? Messages are targeted towards a single process instance. To be able to trigger multiple instances with an event, a signal must be used. But this is not the case, because as you described, you don’t want the definition A to be triggered when B is deployed.
It is not possible to keep multiple definitions with the same message as the start event trigger since that would break the BPMN spec. If you still need the A definition, B must reference a different message. If you don’t need A definition anymore, you can try to delete the deployment with an API call.
Summarizing: BPMN has its own rules and “moving” message references from one definition to another is not a supported concept. If you want more flexibility in the way you trigger processes, cases, etc., I’d recommend to explore the Event Registry engine components.
In any case, it’s not a good idea to execute destructive SQL queries against the database.
I hope this helps!