No it doesn't, Mary and Joseph were married under Jewish law, not Catholic.
You just defeated your own argument.
They were married under Jewish Law which recognized their marriage as valid although not yet consummated.
That’s why Joseph had in mind to DIVORCE her.
You only divorce someone you are legally married to. You aren’t divorcing someone when you break off an engagement.