The UK prime minister defeated moves to alter her government’s plans on customs and trade, but more obstacles lie ahead.