Those two situations are exactly the same.
They involve nations gaining power (directly/indirectly) be retrieving territory they formerly lost. If it makes sense for one, it makes sense for the other.
The difference is that Hungary never ruled Kiev and by feeding Ukraine, which they force vassalized after force releasing Ukraine from Poland, they're expanding their own power, not Ukraine's, because they're just going to annex Ukraine as soon as they have the DIP, if they haven't started annexing already. And in the meantime Ukraine's armies are fighting for Hungary.