Um, yeah, that was stupid. Russia didn't invade Ukraine because Poland joined NATO.
Besides, we never signed a treaty or agreement not to expand NATO. We merely had a discussion about the effects of German Reunification on NATO and the now defunct Warsaw Pact. Since the USSR and Warsaw Pact no longer exist, such "assurances" largely became... meaningless.
en.wikipedia.org
An agreement we never made, and wasn't really relevant because such discussions happened before the USSR collapsed.
You do get that once the USSR was gone, such assurances or discussions became kind of moot, right?