Maybe because he first referred to breaking of the commandment of the Lord and then referring to the Lord in the people that he sinned against.
I could also call out:
“I have sinned against you, against my people and against myself, Lord, for you are the life, the life of my people and my life.”
In all three is the Lord and the Lord alone, because sin separates me from him alone in him, in others and myself.
I’m in darkness after all and out of darkness I cry in confidence of his mercy and only His mercy.
God stands above all creatures. Nevertheless, I am sure he asked Bathsheba for her forgiveness too to prevent her throwing a knife at him.