If you find yourself tilting massively and losing your bankroll when dealing with a bad beat, it sounds like the reaction is much more expensive than the initial situation. While this can be frustrating of course, the good news is that this is the part that you can control and you’ve managed to identify the problem—which is a huge first step.
Personally I’d go with a hard and fast rule if I had this problem myself—stop playing immediately when you feel tilted. If you’re still in a tournament of course play it out, and try to be mindful of your self-destructive tendency. If you’re playing cash though, sit out right away.
In addition to that, I wouldn’t let myself play again until I’d studied a pre-determined amount of time, and I’d start with studying stuff to specifically strengthen my mental game—something like “I have to study 6 hours and feel ready before I play again.” I know the 6 hours probably won’t all be able to be accomplished that day, and that’s part of the point. Hold yourself responsible for playing well and hopefully you won’t lose your roll making plays you know to be suboptimal in the future.
Best of luck to you and hope this helps! [emoji4]