Welcome to a Bronze Age view of divinity. This is why I don't really buy the idea of using psalms too much for modern theology. They are very much products of their time and of the person who wrote them.
Agree with
@paradox3. This really was not part of the theology in David's day. God was your strong arm and ally in smiting your foes, not teaching you to cuddle Hittites or whoever you were fighting at the time.
In the end, it's all mortal, not godly. Gods don't write books, people do. Religious scripture is our writing about God and is all biased by the values of the society and writer. So we need to read all scripture with that in mind. Which is kind of the point of threads like this. By discussing and thinking about the writing, maybe we can find what truth there is in that writer's biased work and how we can apply it in our rather different age.