While the Enterprise
-E was never officially called the Federation flagship onscreen like the Enterprise
-D was, I'm inclined to think she was and that gave Picard more or less the authority of a commodore when it came to fleet operations. Another possibility is that at the Battle of Sector 001, Picard may have simply been the most senior captain on the scene upon his arrival and everyone in the fleet knew it.
As far as why didn't Starfleet put Riker in command, I think they knew they would have also required Picard to leave
the ship as well and there were more important things going on at the time (such as the Borg invading Federation space), so the quickest and easiest solution was to simply the entire Enterprise
out of the equation as an unknown factor.