theprestige
Penultimate Amazing
Torture is not merely "unpleasant", and torture is also a war crime. Torture is also different from force used to prevent a crime, or shooting an enemy soldier during war. In fact, torture is so different from every example you have provided that I cannot see how your analogy works.
It's not an analogy, it's a distinction: Unpleasant things governments do to people as punishment for their crimes, distinct from unpleasant things government do to people for other reasons. In my opinion, the 8th Amendment puts a loose constraint on the former category, and says nothing at all about the latter category.
And in my opinion, torture should be prohibited in the former category. In the US, this seems to be handled at the constitutional level by 8th Amendment. However, I think it could be morally permissible in some circumstances in the latter category, provided certain conditions are met. Generally, though, it's prohibited as you say--a war crime according to many jurisdictions and treaties.