It is really a Gray Area.
My company consult to a well reputed law firm.
Accoring to them, Historically I-140 was getting approved within 90 to 180 days so that I-140 approval before changing jobs while I-485 is pending after 180 days was not quetionable.
Now, I -140 approval takes around 300 to 600 days depending on the case type and service center.
I-140 is employer specific and employer can revoke it any time at will. At the time of approval of I-140, employer-employee relationship must exist. Legally, I-140 must be approved before using AC-21 portability since in the AC-21 memorandum, It is not mentioned that one can change the job while I-140 is waiting for 180 days. So, it is risky to change jobs while I-140 is pending. And in any case, if BCIS issues RFEs or finds out about changing jobs before I-140 approval, I-140 is denied.
As I said in the heading, it is really a gray area. And if you are lucky and application goes through without any RFEs & Employer does not revoke I-140 petition, then I-140 may get approved. But again, It is very risky and should be used as a last option in case if someone gets laid off.