A.I.: Artificial Intelligence/WMG

The David robots set off a series of events that lead to the post apocalyptic super-mecha seen at the end.
A perpetual child would get really old, really fast, not to mention kinda creepy after awhile. Eventually, the company released upgrades for the Davids that included enhanced intelligence, and the body would be brought in and changed to simulate growing up. Eventually, the Davids reached adulthood. This would bring forth a brand of robot never before seen; robots that had no purpose other than to live. Immortal beings with supercomputers for brains. They upgraded themselves/made robots for themselves until eventually, the super-mecha were made.

The super-mecha destroyed humanity.
With the way that humans treated robots, and the way robots were getting more and more advanced, an uprising was only a matter of time.

The film takes place in the same universe as Spielberg's version of Minority Report.
A.I. takes place about thirty or forty years after the events of Minority Report. I'd look for proof that Precrime existed to back this up, but it's all underwater with the rest of Washington D.C.

The ending with Monica and Teddy didn't really happen.
Rather than actually cloning Monica, the super-mecha programmed the fantasy of the perfect day into David. This would explain the weirdly convenient one-day clause for cloning, as well as Teddy's implausible survival.
 * It was stated that it was a kind of "memory track", or something like that. It was really in David's head, thanks to the super-mecha.