I think in these cases, the defence's job is to make sure the prosecution and police have done their jobs properly.
If you have a system where people are pretty much guilty before any trial, and there are countries like that, then that makes it easier for innocent people in other cases to be found guilty. It's easier for the state to go for their enemies.
So it's to keep the other side in check by always providing a defence, no matter what.