So then, does the [alleged] perpetrator have the right to defend himself from a police officer with a baton?
If he's attacked for no reason while complying with the officer's legitimate orders, of course. If he started it, then no.