Or maybe BaB isn't just how to attack? Maybe it also represents general experience at tussling and how to aim, aim is important for mages.
Maybe's it's an abstract concept designed to provide a baseline for all creatures in the game so that they are running similar mechanics and thus part of the system rather than trying to make every single class and monster its own game.
Every class in 3e gets skills, saves, bab, and hit points so multi-classing can work out on some level, so combat maneuvers aren't instant kills at low levels, so mages have spells that work against monsters with high saving throws, and so casters buffing themselves isn't a waste of time.
They still get BAB, it's just zero.
Note that one thing missing from your list of "every class gets" is spells. If casters get spells and melee'ers don't, what do melee'ers get that casters don't?
Not sure why casters need BAB (other than the aforementioned ranged touch spells, for which we have two proposed solutions already). You say "aiming is important for mages" - but truth be told, other than rays, their other spells automatically go wherever they want --> so there must be some magical (non-BAB) aiming going on.
Giving casters zero BAB would not change any mechanics in the game, and would not give casters their own mechanic (unlike spells, which do give casters their own mechanic), it would simply take away a benefit that maybe should be left to melee'ers.
Casters have many ways to buff themselves that don't involve BAB. Anything that prevents damage, increases AC, increases any stat other than Str, Haste, etc., etc., etc. I hardly think giving zero BAB makes buffing a waste of time. I haven't seen too many mages casting Bull's Strength on themselves.
Also, I don't think many high-level casters rely on ray spells against creatures with high saves. Methinks buffs, de-buffs and "no-saves" are more likely to be used.