Don't use reflection to extract MacroExpansionAttachments

Also fix an error that was causing nodes to be traversed multiple times.