I’m not completely certain about your question or what you are driving at.
Nevertheless, it is important to note that as our creator God is the potter and has all of the rights over the “clay.” There are a number of complexities concerning ancient man that have a bearing on why God would allow killing or even command it. In the course of time after the fall of man, the earth was populated with many barbaric pagan peoples. God selected the Jews as his chosen people as part of the process for bringing salvation to mankind.
When the time was right God chose the Jews as a way of introducing himself to men as the one true God. In battles with other peoples, pagans trusted in their gods for victory. Pagan beliefs were deeply embedded and were not easily rooted out. Even the Jews fells into idolatry at times.
God essentially demonstrated to the Jews that he was the one true God. He did this in part by vanquishing their enemies and by extention their false gods. This was probably something that was necessary for both the Jews and the pagans to see in order for them to realize that there is only one God. Not everyone was convinced and even today many do not believe in God. God’s justice is not always easily understood by us, but one can see that the belief in pagan gods and all forms of idolatry could not be easily overcome. Stern and fatal measures were sometimes necessary because of the lack of sophistication within mankind. Moreover, God is just and there is no reason to assume that his creatures, which are insignificant by comparison, are not his to do with as he wills. God’s purpose for man and desires for man required extreme measures to bring man out of the depths of his own depravity.
This is but one angle and not necessarily well developed or well stated, but I hope it helps.