R Shlomo Goren and his autobiography (With might and strength) explains that he was at the Dome of the Rock the day it became liberated and saw it as a special one-time opportunity. He writes he went back up to the Temple Mount and went to the Dome of the Rock with sappers. He took a Sefer Torah and shofar with him.
This was a once-in-a-lifetime opportunity, because under normal
circumstances, Jews are not allowed in there. For one thing, this is
where the Temple stood, and we are impure from touching the dead.
During wartime, however, when we have to go in to check for
explosives, that is considered conquering the area and entry is
permitted. During a military conquest, even entering the Holy of
Holies is permitted.
R Goren, unlike the Chief Rabbinate, believed it was actually permitted to be on the Temple Mount. As Shifra Mescheloff notes in a very relevant and interest paper
Rabbi Goren was of the opinion that the location of the Temple area
can be determined with certainty, by measurements, by relying on
sources, mainly the writings of the Sages in the Mishna of Tractate
Middot, and from Josephus' descriptions. This would enable people who
are impure from contact with the dead, ,i.e., everyone, to enter the
places on the Temple Mount which are outside of the Temple area [...]
After Israeli Defense Forces entered the Temple Mount during the Six
Day War, Rabbi Goren ordered the IDF Engineering Corps to measure the
area of the Mount. The task lasted two weeks, after which accurate
maps of the Temple Mount were edited and drawn. In his words – "on the
basis of these maps it is possible to delimit the areas in which
entrance is prohibited according to Maimonides and his stringent
faction, and the areas which people impure from contact with dead
bodies are permitted to enter"
The Chief Rabbinate rejected this view (see e.g., here and here) to the sorrow of R Goren.
The video you are referring notes it was taken "moments after the Temple Mount was liberated". I believe it is referred to on p. 12 of Shifra Mescheloff's paper. It is likely the soldiers were acting under the instructions of R Goren, the Chief Rabbi of the Army, and the incredible emotions of the day. The full debate on the permissibility of their actions only came to light later (see p. 13).