I think you’re mixing up a few immigration rules. If you’re an H1B visa holder, then you can transfer to a new employer any time you’d like regardless of whether you have an approved I-140. The H1B process is separate from the green card process. No matter what, your new employer would have to file for an H1B transfer for you.
However, if you have an approved I-140, then you can keep your green card priority date once you transfer your H1B to your new employer and you can request a 3-year extension on your H1B. It becomes a bit more tricky, however, if your employer decides to withdraw the I-140 after you leave.