Reaction cards in response to reaction cards
The key point is that you're not reacting to the reaction cards. Rather, you're reacting to what happens after those reactions resolve. Thus there is no "going back".

There actually isn't nesting in your examples. This is what should happen for your 2nd paragraph example. I've indented the reactions

Buy Ill-Gotten Gains.
Gain Ill-Gotten Gains.
Other players gain curse (triggered).
    Watchtower: trash Ill-Gotten Gains
Ill-Gotten Gains goes to trash.
    Market Square: discard to gain Gold
Discard Market Square.
Gold gained.
     Watchtower: put gold on top of deck.
Gold goes to top of deck.


There is no nesting; events are purely sequential. The cursing for buying Ill-Gotten Gains should happen as soon as you buy it (think of it like a "triggered event" in MtG if that helps). When you use the Watchtower, you're no longer gaining Ill-Gotten Gains, but your opponents have already taken their curses.

First paragraph example:

Buy a card (say, a Copper).
Would gain Copper*...
    Trader: gain Silver instead
Gain Silver.
    Watchtower: trash Silver
Silver goes to trash.
    Market Square: discard to gain Gold
Discard Market Square.
Gain Gold.
    Watchtower: top-deck card just gained.
Gold goes on top of deck.


Reaction cards are revealed sequentially, and their owner may choose whether to reveal them and in what order. (As the old Isotropic server demonstrated sometimes annoyingly, but very effectively, you can even reveal reaction cards multiple times. You can reveal moat 4 times for the same effect as revealing it once.

This is why, for cards like Horse Traders or Market Square which could have a compounding effect if revealed more than once, using the reaction requires you to remove it from your hand.

Hopefully things will stay sane and the upcoming Guilds expansion won't introduce a reaction card that can be revealed in response to someone else revealing a reaction card. On second thought maybe that would be fun...  Unless that happens though, there's no nesting, just a sequence of reactions.

(*Trader footnote) Note that Trader is special: it's wording is "When you would gain a card," and the Hinterlands rules state explicitly that if something would have happened due to gaining the other card, it does not happen. Thus Trader is like an MtG replacement effect for gaining a card. The original card is never gained. With Watchtower, you gain the original card, then send it to the trash.