I'm testing with sandbox environment.
Whenever user's payment failed and status becomes "Pending", membership ID is "0 (zero)".
Even if the user already has membership ID, and tried to renew or upgrade.
I expected that it would keep the user's original membership ID even for Pending status.
The Membership ID is only calculated and stored when subscription record become active, so it is expected behavior. For this kind of subscription record, unless users makes payment for you manually, it doesn't affect anything. So in this case, I guess you can just delete the record if users choose PayPal but doesn't make payment