I learnt from this question that Dormammu is a being who lives beyond time.
Generally, when you reverse time, you reverse everything including the memory of the person existing inside the time. Since Dormammu doesn't exist in the time, his memory does not get reset, therefore he gets tired of seeing repeated thing for many times and is defeated.
Hence he knows what is happening around him and that he's locked in a time loop. If Dormammu could acquire the Time Stone by force, he could have broken the time loop. Since he knows that Dr Strange has set a time loop, why did he not attempt to steal the Time Stone instead of trying to kill Dr Strange?