To qualify for AC21, your 485 has to be pending for more than 180 days and the job needs to be same or similar classification.
Regarding 140, there is no requirement that it has to be approved at the time you change jobs using AC21 but it NEEDS to be approved eventually prior to the adjudication of 485.
The only problem if the 140 is not approved at the time of making the job change is the risk of employer revoking the unapproved 140.
If the 140 is not approved, it is revokable.Once it is approved, the previous employer can still try to revoke but AC21 covers you and you are safe.