The Exile section of the Menagerie rulebook is very clear.
QuoteExiling a card from the Supply is not "gaining" the card, and will not cause "when you gain this" abilities to happen. Discarding a card from your Exile mat is not gaining it either.