If Pyromancy 101 is countered or otherwise fails to resolve (probably because the target became illegal), none of its effects will happen, including teach. The card will go to its owner’s graveyard and won’t be exiled.