I can see that there are two answers and the order of the verb and the noun doesn't matter. Is this generally true? What is the wider grammatical rule related to this? can i say רצים הילדם instead of הילדים רצים ?
You can't really say ?רצים הילדים. It would be understand but it's non-standard. I guess the reason this sentence can be either ממי לומדים הילדים or ממי הילדים לומדים is the preposition at the beginning: ממי.
Generally, when the subject-verb part of the sentence is first, it is non-standard to switch them. But if anything comes before them - a question word, a time description, a place description - they can be switched.