The timing is bizarre, though.
@Wreckage Hothead makes a plausible argument that it's literally just because that was when she suddenly realized she could use the Gungans, but as a personal arc it demands she suddenly have a realization that the Republic is useless
at her moment of triumph in that area. The window between having Valorum ousted and leaving Coruscant is a
weird time for her to suddenly have developed in that way. Especially given her later character as a believer in the merits of the Republic and Senate.
I mean people can be complex. She set in motion a huge change, and yes hearing from Jar Jar that the Gungans have an army definitely informed her decision, butthere's something to be said for her in-the-moment decision to enact the senate vote and realising that it would still take time.
People have this bizarre idea that film characters need to make perfect raw calculus decisions like they're all the flanderised idea of grand admiral thrawn, but the simple fact is that's not how people are.
She believes that the vote can make a difference, but she pulls the card in immediate response to Valorum folding after Palpy put the idea in her head earlier. It's a spur of the moment decision, which is then followed by her contemplating more in her rooms with Jar Jar, where she makes a more resolved decision that yes, the vote may well better the Republic and senate and solve her problem quicker than the courts... but there is still inherent time involved, so she'd rather go where she can help.
Of course excluding a case of complete madness, there has to be something about the idea of going back to Naboo that isn't just pure delusional suicidality - or it'd be an entirely different plot / a real short trip, wouldn't it.
So the question is ultimately what that is - the Gungan army? At first it seems like it, however later they're just used to "draw out the huge army in the city" which is "a lot larger than we had thought".
But.... did it appear
that huge during the initial invasion? Why would it be? And why keep such a huge army on the ground but completely remove the blockade?
What if instead they had returned and found 10x more blockade ships but 1/10th of the initial robot army? Or both forces had been reduced? Or both increased?
It looks completely arbitrary, and makes it really easy to imagine a version where there's no Gungan army, and no huge army in the city to draw away from the city, and they just sneak into the occupied city that'd been shown at the beginning, and that's it?
So how'd they manage to start a fight this way now, well maybe there's all this secret combat/revolt preparedness that they'd been hiding all this time - thought "let's exhaust all options before going full armed resistance", and then that's what happens?
Or maybe all these things just surreally manifest themselves once Amidala just gets into a fighting mood after all these frustrations, disillusionments and procrastinations in the Senate.
Or maybe those things don't manifest themselves, but just growing courage and an attitude is gonna enable them to fight back and win (by magically reducing the droids' blaster hit rate while increasing their own - it's happened before)?
Either way it's true that the "Gungan army" didn't have to be, and maybe even wasn't a crucial component of this - just an enhancing one.
A lot of this is ultimately driven by tone - in this case conveyed by, well face expressions of course, along with the "time of the day" on Coruscant and the soundtrack.
When the Senate scene ends with
"Now, they will elect a new Chancellor... a strong Chancellor - one who will not let our tragedy continue."
, the tone is uncertain, ambiguous, rather than bright and triumphant - followed by a transition into this next scene, taking place during a moody sunset and containing more worry and uncertainty revolving around that other plotline:
"The boy will not pass the Council's test, Master - he's too old."
"Anakin will become a Jedi - I promise you."
"Do not defy the Council, Master, not again..."
Then it cuts to the test, and that scene of course ends on this note:
", hate leads to... suffering. I sense much fear in you..."
The sun is seen finally setting, uhhh, a somber night begins, and Amidala is staring out the window in a clearly melancholic, uncertain mood that doesn't stick out like a sore thumb in this scene succession at all:
"Yousa tinking yousa people ganna die?"
"I don't know..."
So the emotional groundwork for a "nope, not good enough even with the elections set in motion; still le sad -> can't stay here like this, need to turn around and start fighting back" turn is successfully set here, and it doesn't fly in the face of the situation either - things
are taking way too long, after all.
So in that sense, Jar Jar just standing there and then mentioning the army can just be seen as an extension of that mood shift that was gonna lead to the same outcome either way - even without him being there, or in the movie at all.
However anyone who just happens to be in mood for a slightly more rational plot progression, you know, "accomplished goal x on Coruscant, this leads to development y that leads to enabling an armed revolt, which is now possible due to z", probably won't find what they're looking for here lol - if seen as a mood-driven, scene transition to scene transition type of construction it seems to hold together a bit better.
Questions about "could've stayed on Naboo and started a successful revolt right there", or "could've run back to Naboo the moment Palpatine started revealing sobering information, why wait till sunset?" keep hovering in the air, unresolved - unless of course this is a slightly surreal universe where they need to go through a certain emotional journey before the universe grants them a stormtrooper victory, then things may look different.