Labour leader Jeremy Corbyn has drawn a link between UK foreign policy and terrorism at home as he returned to campaigning.