They probably are tricked.
The AI in the games isn't known for being overwhelmingly...clever.
It probably does trick them into thinking it's some other Pokemon, but that still doesn't mean they would use a move that's super effective against any of those, but it probably increases the chances.
I can't confirm this as info on it isn't overflowing the internet, but it would be my best assumption.
Hope this helps.