Being the senior officer aboard doesn't equate being in command; Hayes would probably have been too busy commanding the fleet to command the ship.
Which officer would face the music would probably depend on circumstances. When the Bismarck went down, it was because of decisions made by the mission commander (that is, commander of the actions of Bismarck and Prinz Eugen both, but captain of neither), Admiral Lütjens; the captain of Bismarck, Captain Lindemann, had little say in the maneuvers that led to the loss of the ship.
In contrast, if a warship sank during transit to combat zone with a flag officer aboard - say, if a carrier got sunk at the Pacific theater due to a random submarine or kamikaze attack - that would probably fall on the captain, not the flag officer. It would have been the captain's duty to zigzag, or scout for approaching threats, or whatever the reason of the loss.
Hayes probably wouldn't have had much leeway in whether to go against the Borg or not. It would have been up to the skipper to keep the ship alive so that Hayes could coordinate the battle - and if he or she failed, there might be an inquiry into whether he or she had done something wrong.
Timo Saloniemi