What happens if the primary and secondary side of a transformer are short circuited mistakenly?
If the primary and secondary turns are identical (i.e. a 1:1 turns ratio) then the transformer will continue to function but of course it won't isolate any more because you've bypassed the isolation.

Consider taking two long wires and wrapping them round a transformer core many times. As a pair they can be shorted together at the ends and this just forms a single winding. If they are open circuited the AC on one winding produces exactly the same AC voltage on the other and so clearly they can be connected together as per your diagram.

Any other turns ratio and the thing will smoke.