While this is occurring Heliodorus arrives at the treasury, vs. 23 is a continuation of vs. 22, receives a flogging and is carried away by his men.
Those persons in the temple, vs.24, were those who went to treasury with Heliodorus, his body guard and possibly some friends:
“24. But when he arrived at the treasury with his bodyguard, then and there the Sovereign of spirits and of all authority caused so great a manifestation that all who had been so bold as to accompany him were astounded by the power of God, and became faint with terror.”
Vs. 28 says that it is Heliodorus’ “retinue” and “bodyguard” that were in the temple with him so the “they” of vs. 30 would be those people, friends and bodyguard.
There are two scenes described, one is the people, the women in the streets and Heliodorus with his group in the temple treasury.
Apparently Heliodorus returns to the temple to offer a sacrifice and speak to Onias, finally leaving.
It's not the people, the women and virgins who are in the temple, they're in the streets, on the walls, at the gates or looking out their windows, it's Heliodorus and his people who are in the temple, the treasury.
Two scenes, the street, the temple.
I agree that you present a plausible reading.
The “all” in v. 20 indeed refers to the participants in the preceding scene. But that scene includes generic “people”, then “women” and then “young women who were kept indoors”. That scene has moving parts: women rush to the temple (why else would they leave their houses?) while the virgins are confined. So when this movement results in them “all” making supplication, it has to be in the temple by the logic of the scene; but the virgins participated in the supplication since they are a part of “all”. Next in verse 21 the unity of the scene is underscored and the priest is a part of it. So this passage, verses 18-22, describes a physical movement to the temple and toward the priest in order to pray together; yet the virgins who cannot move are still a part of it. Therefore they have been in the temple to begin with.
The issue that I see with your reading in verse 30 is this part: “the temple, which a little while before was full of fear and disturbance...”.
But “fear and disturbance” occurred, according to your vision, in the streets, and not in the temple.
Young women who had been secluded in their chambers rushed out with their mothers, sprinkled their hair with dust, and filled the streets with groans and lamentations. (3 Macc. 1:18/NRSV)
So these virgins were in their houses and rushed to the temple with their mothers also in the 2 Maccabees scene in focus. Dr. Marhsall was tripped up by the error in the Vulgate.