So I assume that when-buy was create due to cards like Talisman that would otherwise have an infinite effect otherwise. Farmland is a bit more subtle; it could work as a when-gain but it could be awkward to get it when it isn't your turn. With a Dominion time machine, do you think these problems could have been solved with "when you gain a card as a result of buying it"?
It exists in Prosperity, because at the time it seemed reasonable, it was a thing that was distinct in the game and I didn't think "people won't recognize that this is different from when-gain."
In Hinterlands I wanted everything to be when-gain, but some cards didn't work that way, and making everything when-buy meant giving up lots of fun. No playtesters could get behind giving that fun up. So I gave up and used a mix and well despite Prosperity I still should have gone with all when-gain. And if I'd thought of it in time, all when-gain in Prosperity too.
I would not use your wording, no. There are various fixes, which can be considered on a case-by-case basis by those who have the time. In some cases the effect is just better not to do, but that's okay, don't be fooled.
Farmland was initially when-gain. And Haggler was "other than via a Haggler." In Hinterlands playtesting we would have these "explosions" that were really fun but also seemed awful to let be in the game. You suddenly gain a bunch of cards. I play Haggler and buy Farmland and that comes with a Lab and I trash Border Village into Province and the Province comes with a Farmland which trashes another Border Village into Province which comes with a Border Village which comes with two Labs. Edit: And one of those Labs comes with a Silver! See how tricky it is.