Did dinosaurs have a neocortex in their brains? If not, when did it come into existence?
Dinosaurs did not have a neocortex - but many of them might have had something neocortex-like.
The neocortex does, in fact, appear to be a uniquely mammalian brain structure. However, birds are dinosaurs, and although birds do not have a neocortex they do have complex brain structures that appear to be fairly similar in function.
The neocortex and analogous bird brain structures do appear to have derived from the same base, which means that somewhere after the amniota split, at least some fraction of dinosaurs did in fact possess those neocortex-like structures that we still observe in birds today.
Since information about brains does not fossilize well, we still know very little about dinosaur brains. As such, it's not currently possible to know whether all dinosaurs had such brain structures, or if it only emerged in the group that we now know as birds.