A teacher at a French preschool who said he had been stabbed by a man shouting "Islamic State" has admitted he made the story up, prosecutors say.