It’s not surprising that Nazi would make compromission with Soviet Union, their so-called biggest enem because that non-invasion pact let those two nations both benefited.
For Germany, the pact released it from the threaten to face two long battle lines in West and East and temporarily avioded the formation of a larger anti-Germany alliance which included Soviet Union, England and France. In fact in 1939 Soviet Union, England and France had an negotiation in Moscow as well. With this pact and the appeasement policies of France and England, Germany further expand it’s sphere of influence and divided Poland with Soviet Union which made it more prepared for the invasion to the whole Europe.
For Soviet Union, this pact let it had time to recover it’s millitary force which had been deeply damaged in counter-revolutionary elimination because too many experienced generals been persecuted. In the Soviet-Finnish War in 1939, the weakness of Soviet army been exposed. When Germany invaded Soviet Union, it’s army had reorganized and showed considerable strength. Moreover, by annexing other countries in east Europe, Soviet Union expanded it’s depth in defense and made the invasion became more hard.
When I read the part you wrote saying “Germany further expand it’s sphere of influence and divided Poland with Soviet Union,” I am not sure if I misunderstood you or not, but I wanted to clarify that Germany and the Soviet Union were only dividing Poland “in the event of a territorial and political rearrangement of the areas belonging to the Polish State” and that prior to WWII, Poland belonged to neither Germany nor the Soviet Union. Additionally, it seems unlikely, at least with the advantage of hindsight, that Germany ever intended to honor this promise, especially since it fell under the heading of “Secret Additional Protocol.”