Answer: I would contend that the right answer is actually the E) Ungrammatical.
Explanation: Just to elaborate a little on the answer, it can be added that this is an example of a dangling modifier—specifically the phrase "while talking on the phone"—and it needs to be revised. Who was talking on the phone? A modifier is meant to clarify or to give more detail about an idea or an action, but it becomes a dangling modifier when, as it has happened here, the doer of the action that it expresses has not been clearly stated. As a result, it seems that the dog, the subject in the main phrase that follows, was the one talking on the phone. A possible revision could be: "While he was talking on the phone, Peter's dog spilled his water dish."