Two South Korean electric-vehicle battery makers reached a last-minute settlement in a bitter U.S. trade dispute, said people familiar with the deal, sparing President Joe Biden from choosing between undermining intellectual property rights or dealing a politically toxic blow to his climate agenda.