Hungary did not elect a prime minister, it elected a parliament. The new govnernment incl the prime minister is just a consequence of parliamentary majorities, which changed.
Each party elects their party leader before the elections. The party leader pretty much represents the party during the electoral campaign. The system in Hungary is mixed so people vote both for a specific candidate from their district and party as a whole. The elections are as much about electing the next PM as the next majority party. In US you first choose representatives and then they vote for the Speaker of the House. You don't really know who will hold this office when voting for one party or another in the midterms.
While that won’t push the US president out if power, it could turn him into a lame duck.
Trump rules by executive orders. A lot of things he does require congressional approval and he just blatantly ignores the law. The courts already confirmed that everything he does is legal and that even his illegal decisions are biding. Midterms will not turn him into a lame duck.