Self Awareness/Consciousness is partly illusion . Take a system – a small bug, tree, a human. At some point in evolution it s survival required more and more sense of its environment so as to avoid destructive elements and seek out productive ones. As the systems became more complex it becomes what we call self aware conscious. Hard to say for sure but at some point whether its dogs, dolphins, apes they system gets complex enough to do more than just react to outside stimuli and reflect on its “being”. It is self aware in the sense we think.
(btw: self awareness may have many different flavors and attitudes so a machine may become self aware but in a way different from us).
In any case though its quite possibly an illusion in the sense the system (ie person) is tricked into believing they have identity. from birth onward other humans and the outside world bombard us with info on our supposed identity.
But the illusion only applies to the supposed self. The actual consciousness is real-just not attached to any particular being. consciousness is an elementary part of the universe that the self folds around just like the self folds around space and time. the actual consciousness is being itself which the universe has regardless.
Being is an aspect of the universe much as space and time are. It just over looked as it is so close to us. We are made of being much as we are of space and time. A machine could also fold around being and have the illusion of self. it would need to be able to independantly react to outside stimuli to greater and greater degress. But i dont think the machine would stop at self awareness. If smart enough it would see past the illusion and see that it is part of the universal being and by extension all others that may have being-whether via illusion or direct.