Teaching them how to enforce their own healthy boundaries with ex might be useful at their age.
If ex is on attack in a really inappropriate way, teach those boys how to respectfully remove themselves from a hostile abuse situation. If they start getting bombarded by texts of that nature , teach them to say “ if we can’t have a respectful non-hostile conversation, I am going to put my phone on so not disturb for a while and maybe later when you are calmer, we can have an calm constructive conversation about this” or something to that effect.
It seems as if for years to come they are going to need to have to learn to have boundaries with their father, even as grown adults. Now is a really good time to start. Respectful boundaries are such an important lesson I wish I knew more about when i was younger