@Marc Autret has written a useful technical investigation of InDesign's MathML implementation, including the `MathObject` class and its scripting properties:
https://indiscripts.com/post/2025/03/indesign-20-goes-to-mathml-2
One important point from that investigation is that native MathObject instances don't appear in the normal allGraphics collection, so enumerating graphics alone won't find them.
Are you specifically looking for a pure C++ implementation, or would calling the scripting DOM from your plug-in be acceptable?