There is no common origin or structure between the various cortexes, their only commonality is that they are distinctive layers at the surfaces of the organs involved.
The cortex is the outer portion of the stem or root of a plant, bounded on the outside by the epidermis and on the inside by the pericycle. It is composed mostly of undifferentiated cells, usually large thin-walled parenchyma cells. The outer cortical cells often acquire irregularly thickened cell walls, cand are called collenchyma cells. Some of the outer cortical cells may contain chloroplasts.
In zoology, a cortex is the superficial layer of an organ. Organs with well-defined cortical layers include kidneys, adrenal glands (adrenal cortex), ovaries, the thymus, and portions of the brain.Botany
Anatomy