^Yes. Exactly. It's not that the ships don't have defenses against these things, it's that no defense is completely infallible. Every form of protection can be overwhelmed if its limitations are exceeded.
I think the problem, though, is that the modern Trek shows and movies have made exploding/sparking consoles into such a routine element of battle scenes that it gives the impression that there are no defenses.