You are, of course, quite correct.
Why anybody thought making a treaty with Hitler was a logical thing to do, given his explicit description in Mein Kampf of his attitude that they would only be observed as long as convenient, is quite beyond me.
Stalin also of course did not abide by treaties when inconvenient, and indeed was planning to double-cross Hitler, probably in 1943. He was foiled when the long war in the West that would bleed the Germans for him turned into a very short war indeed. Making his almost complete purge of the Red Army one of the most poorly timed policies in history.
Stalin apparently had some sort of mental breakdown when Hitler beat him to the double-cross. Just wasn’t something he was used to.
But then we make treaties with the Norks, who we KNOW will only abide by them as long as they feel like it. I wish somebody would explain to me what the point of getting a pledge from someone you KNOW is lying is.