Why wouldn't a self ID law allow that?
Because a) there is zero evidence that it has happened anywhere where there is a self-identification law, b) self-identification laws require you to sign legally binding documents stating that you intend to live the rest of your life as the gender you are legally assuming and so aren't as simple or as lacking in consequence as detractors like to straw man them to be, and c) women's shelters can and do have the right to exclude anybody that they feel will be a threat to the women inside them, regardless of that person's gender. Someone assuming a gender that is not theirs in order to infiltrate a women's shelter would be opening themselves up to more legal repercussions than if they just tried to get in without doing so, and would almost certainly be unsuccessful anyway due to the screening process. Two reasons why it doesn't seem to actually happen, despite the hand-wringing.
It's also worth noting that the change in the law would have disallowed women-only organisations from excluding trans women purely because of the fact that they are trans. It's not currently illegal for women's shelters to accept trans women. The majority already do.
And yet, still no reports of this actually happening.
You can read
this report, based on interviews with 15 professionals in the field, and the consensus is clear - trans women are already accepted by these services, that trans inclusion has been a positive thing, there has been no negative reaction from cis women in the shelters, and none of them have found cause to use the exemption in the Equality Act to deny someone on the basis of being trans.
It's also worth noting that a couple of them say that they have likely given refuge to trans women without knowing that they were trans. So it seems like at the moment an abuser could gain access without needing to legally change their gender status anyway, rendering the whole argument moot.
I'm open to opposing evidence. I reiterate my challenge above for anybody to provide evidence of meaningful harm caused by self-identification laws. I add to that another challenge for anybody to provide evidence that inclusion of trans people in women's shelters makes the cis women unsafer, or otherwise causes them any distress.
And if you can't do either of those things, with information available from many years and many countries, then you should ask yourself on what your belief that it
is harmful is based.