I don't mean to imply that you empty all but four cards by the start of your last turn. For sure, a decent chunk of gaining and trashing is done during that final turn.
but then how do you account for all the other cards gained except for watchtower or doctor?
Farmland ought to be possible. Do Feasts, Mining Villages, BoMs or what-not to get down to nothing aside from:
Supply: Province, Farmland
Hand: Overgrown Estate (or Cultist), Trader
Buy the Province. Then buy the Farmland, trash OE to draw your Province, then reveal your Trader to not gain the Farmland. Then buy the Farmland again, trash the Province, reveal Trader. Then buy the Farmland again, trash the Trader, and gain the Farmland.
The question is how can you trash the cards you have gained? You cannot play any more actions since you are now in your buy phase. You cannot use trader since the cards would not be trashed only replaced by a (presumably empty) silver pile. Now, I do think your solution might work, but I think it needs to be adjusted slightly.
Do Feasts, Mining Villages, BoMs or what-not to get down to nothing aside from:
Supply before the buy phase: Farmland, Province, 12 other kingdom cards
Hand: Cultists (variable amount, but at least 4+OE), trader
Deck: 28 or fewer cards
Buy all the piles except farmland (not revealing trader).
Buy Farmland, trash cultist, reveal trader not to gain farmland. Do this a total of five times so you draw the 13 cards you just bought.
Now, if you had cards in your deck you will need more cultists and possibly an OE in your hand. At most there could be 28 other cards gained that turn and put in your deck. You can gain at most 31 cards (30 from cultist trashing, 1 from OE) so the 13 cards that you must buy + 28 others that you may need to draw. This is assuming you have 43 buys from your other plays (for 31 cards you would need 11 buys for trashing cultists+31 buys to trash other cards+1 buy to trash trader=43 buys)
Keep buying farmland, trashing all the other cards, revealing trader not to gain farmland.
Then finally buy the farmland, trash the trader, and you end with only farmland.