Hi,
I'd get into writing a helper object to keep track of things - written in C - because this does make the process of dynamic patching a lot easier. You can encode object types and connections in such an object I guess - this is a bit like writing an object that makes a map of Pd patches, and you could encode the connections as well. Perhaps iemguts does this although I don't know it that well. (it's the patch itself we're trying to query after all - what objects, in what order, and how are they connected, and in what order).
i guess this is also just what dyn~ (http://puredata.info/Members/thomas/dynext) tries to do. gr~~~