We don't know an awful lot about self-awareness or how it can arise. In fact I'm not sure that we actually know anything. How do you prove to me that you are self-aware rather than just programmed to assert that you are? Or even, how do I know that I am self-aware rather than just something else's dream? The ancient Greeks and Shakespeare understood this. Occam's Razor is the only way out that I know.
Two good SFnal treatments of awareness arising unexpectedly: Greg Bear Queen of Angels and Charles Stross Rule 34.