Richard,
The ‘threads” are the ends of bolts inserted from the cylinder end and your problem is that the heads are not anchored and the bolts can turn. You will have to access those heads to hold them unless there is enough free thread after the nuts to enable you to hold that initially and then hold the exposed thread behind the nut once it has moved enough?
When you finally replace the master cylinder weld a small bar – say 3mm dia and 25mm long – across the top of the bolt heads so that it will interfere with the cylinder body and prevent the bolts from turning.
B…..