It's tough being in this little triangle. The best way is to remove yourself, if possible.
When H and I met, he'd been divorced 2 years. Still, his ex was the same as your BF's ex - "if only wS was gone, we could be a family again!" (said through the then-4-year-old). We have been married 7 years now, and ex still sees me as a huge obstacle, and consistently spewed vitriol. She also used to arrive at our house uninvited when no one would respond to her texts or answer her calls. I tried for years to pacify her and assure her I wasn't a threat to her, and nothing worked.
The key to stopping the crazymaking? DISENGAGE.
There's no reason you should have any contact with her. You aren't married to her children's father. You don't live with the children (I assume?). You are none of her business. It sounds like you already took actions to cut off contact - I would make sure that you are completely no contact with her now. (It's absolutely okay to make these choices - I will call the police if ex shows up at our home uninvited again, despite the fact that SD12 lives with us. Ex understands that I am completely serious about this. )
These actions take you out of the immediate path. Unfortunately, as someone who loves someone who has to deal with the crazy, you still get residual blowback. For that, I have a therapist. It helps me to deal with the gaslighting from ex (when someone tells you enough that you're trying to steal her kid you really start to question your own actions) and the frustration of not being able to fix the situation and stop the lies aimed at H and SD.
For me, the constant dinging of H's phone was very triggering. I could always tell by the cadence when it was ex texting, and it spiked my anxiety. We decided that H would move to a parenting app (we use TalkingParents) for all communication with ex. He blocked her on his phone. This means I don't have notice when she's having a meltdown. It means no one has to look at the app until it's convenient for us (no more being interrupted during dinner). It also means we have good threaded documentation of the crazy. Our household is much more peaceful now

Your boyfriend needs to make sure he has a good, assertive lawyer. It sounds like his ex is not going to be able to provide stability for the children. It isn't going to be an easy fight, but hopefully the court will see the truth - and the lawyer can move things forward.
He needs to share with the L EVERYTHING that was on his phone, because it's very likely his ex has screenshots. Anything that could be twisted to be used against him should be disclosed to the L, so that there are no surprises.