Most states have an exception in their dog management law that allows a dog to bite a trespasser or reasonably defend their people or property. How they explain to a dog what "reasonable" is - I don't know.
There's definitely wording to that effect in SA and NSW. I cannot for the life of me figure out what the rules are in Victoria - they're so vague. And I can't be stuffed looking up the rest but willing to bet - there will be an exception to the biting dog rule for trespassers or people who threaten the dog's owner.