Isn't it true that once you see that your opponent is going for Vineyards, you should hold off on the Duchies?
Not a bot bought potions on turns 10 and 12. That tells you that he's going to just start getting vineyards on his next shuffle. If you're going for provinces, the LAST thing you want is a long, drawn-out slog which gives him the chance to get his 7 vineyards and get them up to 6 points each, you want to keep hammering the provinces and end the game earlier than that.
You bought provinces on turns 8, 10, and 12, and if your opponent was also going for provinces, turn 13 would be a great time to get a Duchy, the game would be about one shuffle away from ending. But your opponent wasn't going for provinces. Turn 13 wasn't near the end-game at all - it was less than half way through the game, which lasted until turn 30. That's why those duchies really messed you up: you reshuffled FOUR times after you bought that first duchy. That's a long time for that duchy (and more duchies) to sit there clogging up your hands and preventing you from buying provinces.
Duchy dancing is end-game play, and I think you badly misjudged when the game transitioned to 'end-game' because you didn't realize how drawn-out the game was, when your opponent was not helping you run down the provinces. Once you saw that your opponent was getting potions, you should have prioritized getting the last provinces and ending the game ahead of getting extra points with duchies.