There is one thing that can cause this occurrence whithout being a glitch. That, is Simple Beam. Most likely, you were batteling a Audino, Elegym or Beeheyem that used Simple Beam on your Pokemon, causing its stat-changes to double. The reason for not being able to use Iron Defense again might be because you already used it and then got hit by Simple Beam, giving it +2 Defense plus 3 Defense= +4 or max Defense.
It was certenly not a Critical Hit, only attacks get those.
Source: Those stupid Audions are always spamming Simple Beam when I'm training.