It is and that is why it protects burglars too and why it prosecutes burglars too.. At present within the UK people cannot take the law in to their own hands. If that changes so be it but until then the law is the law.
There is another side to this argument.
Some of those who shout the loudest that we should be allowed to kill people who commit crimes against us and that offenders should be sentenced to longer and tougher sentences, are often the same ones who shout the loudest about alleged police abuse of power and how they convict the wrong people.
De we really think that members of the public being allowed to take the law into their own hands would be more competent to judge who is guilty or not guilty?
It is difficult to be right in all cases.