Neither of your sentences is idiomatic English.
I’ll start with your second one, since that presents a simpler problem
I used to go there whenever he used to come there.
Used to refers to a past timespan during which you repeatedly performed some act: during this period you made a practice of ‘going there’. But whenever, although it encompasses every instance of his ‘coming there’, refers to the individual points in time when he performed that act. Used to ‘scopes’ over your practice, not his: it was not his practice of ‘coming there’ but his individual acts of ‘coming there’ which triggered an instance of your ‘going there’. Consequently, you want to use the simple past to designate his individual actions:
I used to go there whenever he came there.
I used to teach my children until they used to understand.
The same distinction between your practice and that of your children applies here; but this is a little trickier because there are two things you might be trying to say.
What you probably mean is that you made a practice of teaching your children, and on each occasion you continued teaching them until the timepoint at which they achieved understanding of the topic. In this case you want to say
I used to teach my children until they understood.
However, it's just possible that what you mean is that you taught your children repeatedly over a period of a time which lasted until the point in time when they became capable of understanding the material on their own, without your intervention. In this case, they used to is still inappropriate, because it refers to a timespan rather than a timepoint. But you could rescue this by employing the related idiom (be) used to NOMINAL, which you would use in a variant which designates the beginning of the NOMINAL state:
I used to teach my children, until they became [or got] used to understanding [on their own].
Note the comma after children—that marks the until clause as an adjunct modifying the entire preceding clause rather than just the final VP: it was not your individual acts of teaching but your practice of teaching that ended when your children achieved understanding.
(These rewrites are designed to preserve as much of your language as possible while making your meaning clear. They're still pretty awkward; but that's a matter of how we use understand.)
Note that the second uses of quasi-auxiliary used to in these sentences is excluded because they occur in subordinate locative clauses which restrict the first use. It is quite proper to use used to in co-ordinated clauses:
He used to come home every summer, and I used to go visit him [whenever he did].
I used to teach my children, and they used to understand. Now, alas, they're too old to listen to me, so I've stopped.