Yes. The game has different levels of Artificial intelligence. Lower level trainers will be a bit more merciful, using moves like defense curl even though they have the opportunity to finish off your pokemon with 4 HP. stronger trainers like gym leaders, elite 4, or the champion won't be as merciful and will know the right time to use STAB moves, super effective moves, and sometimes even predict a super effective move and switch accordingly.