#31044 introduced ensureNoSelfReference on the _agg object in scripted metric aggregations.
It would be nice if there was a switch to disable the it. Upgrading to 6.4 caused something around 20x performance degradation for us. And downgrading was no fun.