It serves no direct purpose to the parties of a criminal case to defend someone you know to be guilty. But doesn't it serve an important indirect purpose in allowing the system to function despite (necessarily) complex laws that laypeople can't navigate on their own?