Uganda is well within their rights as a sovereign nation to pass whatever laws they like. I am well within my rights as a free person to say that they are dead wrong. And, the US government is well within its rights as a sovereign nation to say that Uganda is dead wrong. Sovereignty does not render a nation immune to criticism.
You are right about nations not being immune from criticism. I'm just not sure our current government has the moral authority to criticize anyone, especially in such a singular way.