Actually, those fetus tissues do look something like gills and do develop into gills in fish.
But in mammals they are reabsorbed as the fetus grows, becoming part of the pharynx, not the ears.
Science has never claimed to be perfect, or to get everything right the first time.
It does, however, have powerful mechanisms for correcting its mistakes, and this one was corrected long ago.
But they claim they do ... and yeah, it was ears ...
PS - the pharynx is inside the body ....