Why would it be surprising?
All parts of the body are built like this. Otherwise we would be blobs.
Before becoming two parts they probably were part of the same parent protobrain tissue.
If you told me the hindbrain was ectoderm-derived but the forebrain was endoderm-derived, I might raise an eyebrow or two.