You might consider reposting this question to Ask Linguistics if you don't get a good answer here.
This tendency has been noticed before, and cannot be explained away by shared inheritance only. Many languages belonging to other families have similar words for "mama" and "papa" - not just Indo-European ones. Additionally, if shared inheritance were the explanation, we would expect the words to have changed in many languages due to sound change over time. There must be something else going on.
It's not an easy question to answer definitively, but the best-guess answer among linguists is that "ma" and "ba" are some of the first syllables a baby can reliably make, and the sound-meaning correspondence gets reinforced because the meanings "mama" and "papa" are both very useful for baby and pleasing to the parents.