I was shocked too, did know there was a Jewish prayer similar to the Islamic one. But it makes sense as Medina was a Jewish town before it got taken over by Muhammad and his followers.
Just today I reading the "Testament of Abraham" written in the 1st CE and it I came accross the concept of angels writing down your deeds which will be weighed on judgement day. The testament reads as follows:
"Deeds good and evil are recorded by two angels and the soul is weighed.
This is “judgment and recompense” (12:15b). A soul is brought forward, but when the book is
opened, “he found its sins and righteous deeds to be equally balanced, and he neither turned it
over to the torturers nor (placed it among) those who were being saved, but he set it in the
middle” (12:18). Abraham is informed that this judge is Abel, who “sits here to judge the entire
creation, examining both righteous and sinners” (13:3a; note the universal scope of this
judgment). Then Abraham is informed of the different judgments all humans are to face. "
Then when we cross reference the Koran, we find the same thing:
7:8 The weighing on that day is the true (weighing). As for those whose scale is heavy, they are the successful.
7:9 And as for those whose scale is light: those are they who lose their souls because they disbelieved Our revelations.