You need to reduce the debt to writing. Now, it is arguable if B tries to dispute the debt under the statute of frauds, that it could be disallowed, but your emails are evidence of acknowledgement of the debt. In the event that B files bankruptcy, they should schedule A in their case, whether disputed or not. If they file and A isn't listed, and it is a chapter 13 (not possible if debt is $5M) or chapter 11, then A can file a proof of claim
to be paid from proceeds in the case. If it is a chapter 7
filing, the debt is only discharged if scheduled. A proof of claim is only needed in chapter 7 if there are assets for distribution, for which you can contact the court and/or Trustee
in the case to see if there are. A can still sue, and try to collect on the debt under the state court rules. If B is garnished, A would have to wait in line. A could attach the judgment lien onto Real Estate or other allowable assets under state law. They would then receive proceeds upon liquidation of the assets (sale, refi, foreclosure) based on the order of judgment lien. Consult a local attorney to monitor the case, perhaps best to stay cordial, to get voluntary payments from B, despite the obligations to the 3rd party suit.