Laughter erupts in Commons as Sunak thanks predecessors for ‘laying groundwork’ for EU deal