It does sound like you were chasing that endorphin high, but doing it in a less than perfect way. But it's great that you can recognize that! If you've identified the behavior, you can actively avoid it. You just gotta check in with yourself sometimes. Ask yourself if you're legitimately feeling sad, or if you're just giving into that because you want attention.
That's not to take away from the fact that you can legitimately feel sad for no apparent reason of course. Morose moods affect all humans from time to time. There's no shame in that. It just comes down to whether or not you're actively trying to get something out of it, when you just need to ride it out instead. The caveat to this caveat being that using sadness to get something from someone is not the same as being sad and letting people know how you feel. It all comes down to if you're manipulating someone or not.