This is why AI is coming whether we want it to or not.
As you stated further down, you're thinking in terms of your IT admin training and in binary, which is quite correct for that field of work. For AI's, you need to think in terms of fuzzy logic and weights.
We can teach AI's that there are different levels of good and bad, and it's better to lean decisions towards good. A core example would be that it's better to create than to destroy. This can be extended further that it's better to let people live than to destroy them. A conflict might occur (at least to a computer) that destroying garbage would be bad, but this needs to be redefined as recycling something useless/broken into something new and upgraded is good.
While a computer will never understand emotions like a biologic can, these can still "roughly" be defined in a way it can understand. Emotions wouldn't be simulated with binary decisions but with varying weights depending on the description, wording, actions, and so on. These weights would then push it's internal neural net in one direction or another.
As far as dynamic firewalling, spam tagging, and dynamic virus blocking is concerned, those have never been very well programmed to begin with. I share your frustration with them. On the flip side, to really do these well would take a much larger AI that's slow, bloated, and not very practical to run on a server... at least at this point in time.