The Hungarian president has frequently sought to obstruct the European Union’s efforts to support Ukraine and punish Moscow for its invasion.