Quote

I'm going to get straight to the point here: In 7, Wily uses Bass to break into Light's lab. We know that he is WORKING on Zero after this. We DON'T know the complete details of what data was stolen.

My guess is that Light had begun designing X sometime after 6. Rock had proven to be enough to bring a single mad scientist to justice, but what if a greater threat emerged? Or, perhaps he only wanted to return to designing peaceful robots, thus the free-will was implemented. At any rate, whatever research and design work Light had done during the peacetime between 6 and 7 were open for Wily to steal.

I'm sure that Light would have realized that his work was stolen. This would be when he designed the X-Buster and began work on creating X. Meanwhile, Wily has the groundwork for a truly sentient robot. Thus, Zero and X share similar sentience and morality, but X has more safeguards against rebellion. Zero, then, is a truly independent robot, after his battle with Sigma, virus aside.