do [something] to [something] like [something]

Usually it's parsed the first way, because the default is to associate a modifier with the closest phrase that it can reasonably refer to. Since "me" immediately precedes "like a child", they're assumed to go together.

But it can be ambiguous and context or common sense usually clarifies. For instance, if you said

Don't talk to me like a monkey.

it probably means that they're making monkey-like noises, because there is no customary way to talk to someone as if they're a monkey (unless the conversation is taking place in an animal preserve, zoo, etc.). But

Don't talk to me like a dog.

might mean that they're saying "Good fella" to you, or they might be barking at you.

If you want to ensure that the second interpretation will be used, you can put "like [something]" before the indirect object:

Don't talk like a child to me.

Now "talk" immediately precedes the prepositional phrase, so they're associated.