A fleet going to a starbase for an upgrade would take the same amount of time as a single ship. So if it takes 1 week to upgrade one ship, it still takes only 1 week to upgrade a fleet.
Only if you take the view that the starbase has infinite space/resources
And you can implement your idea right now simply by moving the fleet to the starbase, initiating the upgrade, then moving it back.
This is true

A few more clicks, granted. But what you propose would require a (drastic) code change in the .exe file, as well as module changes in the .xml files. Doubtful it would happen.
Being an OO programmer myself that I find hard to believe. They will have a Ship class with an upgrade method(s). Locate nearest Mil Starbase, plot course, take money(already done), set flag so course cannot be altered. turn event code for if SB gets destroyed then locate nearest starport/SB, do upgrade, return to original point (default) or change course manually.
XML changes?, sure need save game code to change, need extra sb module or SB upgrade tree etc.
Could be part of expansion 3 or GC3

A better change would be to alter the AI to upgrade just before they declare war, and to upgrade when war is declared on them - in just that fashion as you describe.
Sure but then that is AI changes, I suspect that is more onerous a change than those defined above. Maybe easiest change all round is to force upgrades to take 3 weeks instead of 1? In fact thats the solution 3 weeks for upgrades..