If we take the facts that it takes about 2 hours to recite the Gita, then it seems very likely that it was given on the battlefield as Arjuna had requested Sri Krishna to take the chariot in the middle of the two armies when they were preparing for the war. It takes a few hours to have all the preparations especially on the first day.
Secondly the Gita refers again and again to the actual context of the dialogue. It starts with Dhritrashtra asking Sanjay as to what is happening on the battlefield between his children and Pandav’s. It closes also with Sanjay’s concluding words on the dialogue.
The very dilemma of Arjuna for which he approaches Sri Krishna is directly connected to the fratricidal nature of the war. Sri Krishna’s reply is also connected to the war itself and the ensuing loss of lives. The Gita repeatedly turns to the war asking Arjuna to fight and slay those whom Sri Krishna has already slain.
So the idea that the Gita is a later addition seems very unlikely.
Affectionately,
Alok Da