I used to do this. It was my way of getting them to change or to give me what I needed and wanted the most.
By threatening a breakup, it sometimes forces the other person to bend to your wishes. But you're right -- it's not a healthy response or a healthy pattern to develop. The better way is to be upfront with your needs, wishes and desires and to have an adult conversation with the person about it. Or, to simply express your hurt feelings. "When you said that, it hurt my feelings", or "I felt hurt by what you did."
I found mostly that I threatened breaking up within an abusive relationship, where my needs were constantly not being met and when I was constantly being disrespected. But you say you do this even in good/positive relationships, so this is something to work on within yourself and to change.
Next time it happens, PAUSE and think before you speak or react. Take your time, and stop yourself from saying the words. Then take your time and think about what you really want and need, and figure out a better way to say it to the person.