A guess at the mechanism: the silk protein selection algorithm is an accept-first filter, the silk ducts being somewhat like human mammary glands. Anything the spider isn't specifically pulling back into its own blood as needed would then end up as an
impurity in the webbing. (Easy experiment to do in its own right, but from a quick search I can't find evidence to support or refute it.)
Past that, the nanotubes just have to get locked into the matrix of the silk in the right orientation... which could just happen to anything of the right dimensionality in the silk as it anneals into shape.