Maya Python: Query input anim curves (and input of inputs like graph editor shows)

I’m looking to query the curves that in a usual scenario the Graph Editor shows - which seems to be more than just the direct anim curve inputs, like if an object is driven by “Motion Path”

So the question is, how does Maya define that this motionpath happens to be a curve that needs to be shown too. I want to query these nodes inputs that would be listed there and get this additional curve too (without needing to open the graph editor).

If I create a color constant, connect it to “translate” it doesn’t show the input keyframes to the color constant, but if I connected color constant, individually to translate X, Y and Z then it does. (Interesting behavior?)

Anyway, is there any trivial call I can do to get these input keyframes that includes these inputs of inputs (and also excludes it in the same way if it’s not a per channel attribute input.).