Programming a computer to perfectly counter a human player is hard.
It's why game design - and game coding - is such an art, because it requires countless small tweaks in order to create enemy or friendly AI that's just right.
In fact, it's such a hard craft that good and bad games alike can have flaws in their AI design. These range from small problems that create loopholes for savvy players, to massive issues that leave you wondering why they weren't fixed.
Because, while you can ignore many mistakes in a game, watching your robot teammate continuously walk into a wall - or watching an enemy end themselves - is pretty impossible to forget. Such is the double-edged sword of a broken AI; because it makes you remember a part of the game forever, but for all the wrong reasons.
That said, sometimes having a funny exploit can add a new layer of interest to an old or otherwise ignored game, so it's not all bad news. After all, seeing mistakes only makes you appreciate all the stuff done right even more - so in a bizarre way, it's actually important that they exist.