I am curious about how old the BBB is, in terms of evolution. Is it present in all vertebrates? or just mammals? or what?
It appears it is all vertebrates.
All extant vertebrates have a blood-brain barrier (BBB), a specialized layer of cells that controls molecular traffic between blood and brain, and contributes to the regulation (homeostasis) of the brain microenvironment. ... The barrier is formed by vascular endothelial cells in most groups, but by perivascular glial cells (astrocytes) in elasmobranch fish (sharks, skates, and rays). It has been unclear which is the ancestral form, ... we conclude that the ancestral vertebrate had a glial BBB. This means that an endothelial barrier would have arisen independently several times during evolution, and implies that an endothelial barrier gave strong selective advantage.
So, all vertebrates have one; in some fish, it is composed of glial cells rather than endothelial cells.
However, insects do have something similar:
Insects also possess protective neural barriers, but they differ anatomically from vertebrates (Figure 1). Drosophila melanogaster (Dm) has an open circulatory system that is separated from the CNS by a thin layer of glially-derived epithelial cells (Treherne JE, 1972; Carlson et al., 2000; Stork et al., 2008), making the Dm humoral/CNS interface topologically much simpler than the vertebrate BBB. However on a cellular level, the vertebrate and insect BBBs share many common features.