The law on this point in England and Wales has recently changed. The main statute here is section 4 of the Animal Welfare Act 2006, amended in 2019 to add an exception relevant to police dogs.
Under subsection (1), you commit an offence if you cause a dog (as an example of a "protected animal") to suffer unnecessarily. The necessity conditions in subsection (3) include the example of protecting yourself or someone else, in (3)(c)(ii), but this list is not exhaustive. Nonetheless, that specific defence is excluded by the new subsection (3A) in the case when the dog is a police dog being used by an officer "in a way that was reasonable in all the circumstances". This exception was added precisely to cover the example of a police dog being used to apprehend a suspect, to stop people from claiming self-defence; it's known as "Finn's Law" after a police dog who was stabbed in those circumstances.
If this came up in practice, for the scenario you suggest, then the court would have to deal with (among other things):
- Was the officer's conduct reasonable in all the circumstances?
- Could the person have avoided harming the animal?
- Was the level of harm to the animal proportionate?
The answers would depend on the exact facts involved, so it's not possible to say in a vacuum whether the elements of the offence could be proved.
Note that the Dangerous Dogs Act 1991, which might otherwise apply to the officer in charge of the dog for letting it be "dangerously out of control", actually does not by virtue of section 10(3) so long as it is being used "for a lawful purpose".
Meanwhile, as a civil matter, there is a strict liability provision in the Animals Act 1971 which might catch police dogs. That Act distinguishes between animals of a dangerous species, where the liability always applies, and others where it only applies if the animal meets certain conditions. These have attracted some criticism by senior judges over unclarity in their drafting - see for example Ford v Seymour-Williams  EWCA Civ 1848 and Mirvahedy v Henley  UKHL 16 - but on the basis of those decisions, one could argue that
the likelihood of the damage or of its being severe was due to characteristics of the animal which are not normally found in animals of the same species
in the case of a police dog specifically trained to attack on command. However, on the other side, whether the claim is under the Animals Act, or for battery, etc.:
- The police may argue that the damage was due to the suspect's own fault. An example I found cited in Street on Torts is Dhesi v Chief Constable of West Midlands Police  WL 491455. A claimant bitten by a police dog was held to have accepted the risk of sustaining damage when he refused to come out of his hiding place, after being warned a dog would be sent in to flush him out; this engaged section 5(1) of the Animals Act and defeated strict liability.
- The police can argue that their use of force was reasonable for the purpose of preventing crime and/or arresting a suspect. (The same argument by which human officers can use force.)
- The police can argue that the dog was no more dangerous than an ordinary dog, that the officer did not know it could cause such severe damage, etc., thus removing it from the category of animals where strict liability applies.
- The police have some protection from civil suit, known as "Hill immunity" after the case Hill v Chief Constable of West Yorkshire Police  UKHL 12, which is not absolute but is very likely to defeat claims where officers were not unusually negligent, not acting outside the bounds of their duties, exercised reasonable care and skill, or did the best they could in a fast and confusing situation. See the recent judgements in Robinson v Chief Constable of West Yorkshire Police  UKSC 4, a case where officers arresting a suspect accidentally hurt an elderly lady, for a very thorough discussion of duty to bystanders and police negligence in general.
So again, it all depends on the fact pattern in the specific case, but you may or may not be able to win a civil claim against the police based on the harm done to you by a police dog, even when you didn't hurt the dog.