What happened was correct. Note that Trader got errata some years ago use the exchange mechanic for the reaction efffect:
QuoteTrash a card from your hand. Gain a Silver per $1 it costs.
When you gain a card, you may reveal this from your hand, to exchange the card for a Silver.
A card that comes into your possession via an exchange is
not gained, so no effects that trigger on gaining (like from Rapid Expansion) happen. The rule was spelled out in the Adventures rule book (which introduced the exchange mechanic for the Travelers):
(https://i.imgur.com/tqodUjE.png)
and is also noted in the updated Hinterlands rulebook in the description for Trader.
Ah ha. Ok, thanks