"Signing up for NATO" aka blackmailing their way into NATO in Poland's case. They really wanted into NATO. There wasn't an eastward expansion from NATO, the east came to NATO.
It doesn't require much study of that part of Europe's history to understand and fully agree that joining NATO is a precondition for any kind of long term national security for these countries. When things get existential, you will cut any corner you can.