Daenarys travels to Dragonstone in Game of Thrones S08E04 and gets ambushed by Euron's fleet, losing both Missandei and Rhaegal in the attack.
At the start of S08E05, we see Jon arrive in Dragonstone, and is approached by Varys, in an attempt to have him claim the crown ahead of Daenarys, which he refuses. He then witnesses Varys' execution, and then heads directly back to his army pitched outside of King's Landing.
What was the need for Jon to make this journey?
He travels back to King's Landing with Tyrion and Grey Worm (and presumably some others) but Jon didn't need to escort them, they could have traveled alone.
Daenarys definitely had access to ships, they weren't all destroyed in Euron's ambush, as she manages to travel to King's Landing and back with a good number of unsullied when she tries to negotiate with Cersei.
Any battle plans they might have drawn up could have been done after they had traveled to King's Landing, as the rest of Daenarys' advisors were planning to travel there anyway to take part in the attack.
Varys briefly discusses with Jon that "she shouldn't be alone". Yet the following day, after Varys' execution, all of her closest advisors and confidants proceed to leave her on her own.
Jon definitely already knew of Rhaegal's death, as him and Varys referenced it as soon as he got off the boat onto Dragonstone, so it's not as if he would have been planning on riding Rhaegal back to King's Landing.
I can't think of any reason that Jon would have made that journey. Daenarys' ships got ambushed right outside of Dragonstone by Euron's entire fleet. It was a huge risk to make an additional journey through Blackwater Bay, where Euron was hanging around, without it being absolutely vital.
Why was Jon needed on Dragonstone so urgently that it couldn't wait until the next day, when everyone involved in the attack would be meeting up with him anyway?