Warren Buffett’s Berkshire Hathaway has fully sold its 17-year stake in Chinese electric-vehicle maker BYD, ending one of the most profitable foreign bets in the conglomerate’s history.