Yes, this is correct.
Whenever you have the option to respond multiple ways to the same event (you gained a card), you can choose the order in which you respond to those things. Until you are done responding to those things, you can continue to choose to do things to respond to it, even if that thing only became an option as a result of an earlier response.
A simpler example that's given in the Intrigue Rulebook is the case of
Moat and
Diplomat (previously Moat and
Secret Chamber). When someone plays an attack; you can reveal Diplomat to draw 2 cards and then discard 3. If one of the 2 cards you drew was a Moat, and you didn't discard it, you can then reveal the Moat to protect yourself from the attack. Even though the Moat wasn't in your hand when the attack was first played.
Basically, Dominion doesn't differentiate timing between "the moment an event happened" and "the time window you have to respond to the event happening". As long as it is still within the time window, you can continue to respond.