Why Gamefreak adding/putting Glitch in Pokemon Games -purposely or not-? I mean some glitch causing the games to freeze or crash, even can made your games data to become erased and you need to start a new one.
They don't put them there on purpose, that's why it's called a glitch. There will be a bug in the coding which causes certain glitches.
Hope I helped!