I don’t necessarily think there is a contradiction, “thou shall not kill” should be be translated as “thou shall not murder” in the context of the old testament.
The word for “kill” used in the commandment was not used in any passages of the bible related to warfare. There is even a clarification that this does not apply to killing other people in warfare or unarmed combat*
While the literal meaning of the 10 commandments has changed relatively little (mainly due to mistranslation or the shifting definitions of words) almost all of them mean would mean very different things to modern christian pacifist, a with burning 16th century calvinist, a 2nd century christian or a 6th century bc. jew.
I mean even regarding killing, while it’s easy for us, living in the modern world, to interpret it as a general ban on killing, a society which did not kill people under any circumstances would likely have been inconceivable in ancient times, it simply could not have existed since it would had been conquered and it’s members enslaved or exterminated by neighboring tribes.
* https://en.m.wikipedia.org/wiki/Thou_shalt_not_kill