SERVER-137381ClosedFixed
Remove dynamic_cast to $match from graph code
The benchmark added in SERVER-136156 revealed that the majority of the time is spent in the dynamic_cast. We should amortise the type check like we do for DocumentSourceSingleDocumentTransformation and turn it into a typeid check since $match has no subclasses.