Some 2,500 years ago, Shakyamuni Buddha taught that consciousness (vijnana) was a product of our "mental maps" or schema (sanskara), which in turn arise out of our subconscious mind or ignorance (avidya). This is not mystical thinking or superstition, but his own observations of the working, functioning mind, and in this TED lecture on the neurology of consciousness, although he never once mentions Buddhism, Antonio Damasio shows that science is now reaching the same or similar conclusions.
According to this lecture, there are little modules in the brain stem that produce maps of different aspects of our body. Damasio describes these maps as "exquisitely topographic and exquisitely interconnected in a recursive pattern." To be sure, these maps are not the "mental maps" (sanskara) of Erich Fromm, but this interconnection between brain stem and body provides the grounding for the self. The proto- or core self is grounded in this very tight interconnection between the brain stem and the body and is experienced in the form of primordial feelings. The conscious mind cannot exist without this interconnection between brain stem and body.
The cerebral cortex, in turn, provides the great spectacle of our minds, the profusion of images to which we normally pay the most attention. Just as a conscious mind cannot exist without an interconnection between the brain stem and the body, a conscious mind likewise cannot exist without an interconnection between the cerebral cortex and the brain stem.
The design of the brain stem throughout the vertebrates is very similar to our own, which suggests that other species also have conscious minds. However, their experience is not as rich as ours because they don't have a cerebral cortex like that of humans. The difference is in the cortex. Consciousness should not be considered as the great product of the cerebral cortex. The richness of the conscious experience is generated by the cortex, but not the fact that we have a sense of self at all.
Damasio describes three levels of the self - the proto-self, the core self, and the autobiographical self. The first two, the proto-self and the core self, are shared with many other species, coming out of the brain stem and whatever there is of cortex in those species. All sentient beings probably have at least some sense of proto-self, likely as a defense mechanism - it's been said that if you attempt to kill something and it runs away, it's sentient.
Some species additionally have an autobiographical self. To a certain degree, cetaceans and primates probably have an autobiographical self. Dogs also appear to have an autobiographical self to a certain degree.
According to Damasio, the autobiographical self is built on the basis of past memories and memories of the plans that we have made. It's based on the lived past and the anticipated future, or what the Buddha called sanskara. It is the autobiographical self that results in extended memory, reasoning, imagination, creativity and language, and out of these come the instruments of culture -- religions, justice, trade, the arts, science, and technology.
So if I'm understanding Damasio correctly, the autobiographical self, what can be called the ego-self, is built on the basis of past memories and the mental templates or models that we have developed and use to comprehend the world. These are the mental maps of Erich Fromm, also called schema or sanskara. Proto- or core consciousness may exist at lower levels of awareness in the brain stem, but the vivid experience of our own selves (vijnana) relies on the cerebral cortex and its mental maps.
Finally, since we are not aware or do not experience the arising of our consciousness (how could we be aware of such a thing? - it would be like "seeing" our own eyes without use of a mirror), sanskara arises subconsciously outside of our knowledge, that is, out of ignorance (avidya). This process, consciousness arising out of schema, and schema arising out of ignorance, is the first three steps of the Buddha's teaching of dependent co-origination, and is now apparently affirmed by neuroscience.