Optimize copying of import nodes (#14157)

Change-Id: I82b2d8e79f874d986b53ab63999c7f357438f338