This was used to prove that all parts of brain utilize same general mechanism.
This is not quite true. While a good deal of reorganization can happen post-damage, brain function will not be re-localized to anywhere. Instead, what often happens is that, if a location on one hemisphere is damaged, the function is taken over by the corresponding location on the other hemisphere. In the extreme, some children have an entire hemisphere removed (to treat seizure disorders), and the remaining hemisphere takes over nearly all the function of the removed hemisphere. Hopefully this partially answers your second question.
To answer your first question, both genetics and environmental input shape how functions get localized in brain tissue. We know environmental input is important because people that are deprived of some kind of input (e.g., vision or sound) will re-assign the brain tissue to processing input that is received (so for a Deaf person, auditory regions in temporal lobe may be repurposed for processing visual input). I can't, off the top of my head, think of concrete cases to illustrate how genes influence function localization, but hopefully it's obvious enough that this is the case / how this might work.
Re: your last question about the brain being self-aware...well, in one sense the brain is self-aware since you are self-aware and you are your brain. But we must be careful about what exactly we mean by "self-aware". It can be easy to fallaciously invoke the homunculus.