How do I run code in a GuiLayerCollector::processDescendants step?

I noticed that some built-in plugin code was running within a GuiLayerCollector::processDescendants step while optimizing GUIs. I immediately wanted to find a way to replicate this as this might be useful for collecting extra frame information Roblox currently doesn’t provide out-of-the-box, but a quick look at the API reference didn’t seem to lead to anything of use.

PlaceAnnotations getting AnnotationsService.Mode

Right now, the client tracker is my best resource that gives me a better net to find what I needed, but I don’t fully understand Luau bytecode so this is a no-go for me.

How do I run code in a GuiLayerCollector::processDescendants step?