I looked up the Model X manual; it's the same as Model 3:
"Model X automatically shifts into Park whenever you connect a charge cable or if two or more of the following conditions are met simultaneously:
•The driver's seat belt is unbuckled.
•The occupancy sensor in the driver's seat does not detect an occupant.
•The driver's door is opened.
Note: The above conditions do not reflect a comprehensive list of reasons why Model X may automatically shift into Park and, in certain scenarios, it is possible for your vehicle to shift into Park when only one of the above conditions is true."
So, if the car behaves as intended, it seems unlikely a two-year-old would be able put the vehicle in drive; one of the following two things would have also had to happen:
1) Something heavy enough to overcome the weight requirement would have to be on the driver's seat. (This assumes a two-year-old is not heavy enough to meet the weight requirement, which I think is likely.)
2) The seat belt would have to be buckled (presumably by the child).
Not saying the described events did not happen, it is just that something must not have been working as intended, or something other than what has been speculated above (child pressed brake and pulled down on the stalk) must have occurred. Or, the Tesla weight occupancy sensor isn't using the weight to detect presence of the driver (for the driver's seat, it's possible that it is simply detecting something lightweight is in the seat and then allows driving). (Which would be a bug, since it has the capability to assess weight - that's how the car decides whether to turn on the passenger airbag or not - it seems to require greater than 75 pounds based on a recent post here asking about it - but it is true I do not know the exact weight requirement and presumably it depends on how it is distributed.)
It's presumed that the door was closed, since the Model X (with premium upgrade package) does that automatically when the brake pedal is pushed. Which seems like a child finger crush hazard, but that is a separate issue and that function can presumably be turned off (I didn't see that available in the manual, but ...shrug...).
EDIT: That being said, I can't see the weight sensor requirement being met unless something heavy was in the driver seat - not the child. The two-year-old will NOT be able to sit in the seat and press the accelerator.
So, that suggests maybe the seat belt was buckled, or there was something heavy enough in the driver's seat to overcome the required threshold (and the Tesla software may or may not have been using the "correct" threshold - or may intentionally be using the lower threshold for some reason).
Or, the car was not working as Tesla describes.