Those were the only options they had in 1941-45.
At least the nazis didn’t invade them, not that they wouldn’t have if they had felt the need, but so it was. If the nazis are the only “friendlies” around then they are your allies by default.
Poland had the option (a very poor one as it turned out) to align with the western allies. That’s because the nazis started off by doing unto them what the Soviets were doing unto the Balts.
The Nazis were allies with the Communists in 1939. Germany and Soviet Russia dismembered Poland as allies, as a team. Molotov-Ribbentrop? How did the Katyn forest massacre occur if the Russians weren’t part of the invasion of Poland in 1939?