Masturbating is totes normal and healthy for people of all types. Even some asexual people - that is, people who don't experience sexual attraction - masturbate. (Which isn't to say that not-masturbating is unhealthy. The only thing that's unhealthy is coercing people to change something that feels right for them and doesn't hurt anyone else!)
And yeah, I also stim by touching myself in a non-sexual manner. Masturbation is probably not the right word for that. Maybe genital-stimming? Or junk-stimming etc. if you don't want to be clinical about it? I think it'll probably be useful to have a label for this concept which clearly differentiates it from the act of playing with yourself for sexual gratification (which, to be clear, I do that too and it's a significantly different thing).
The important thing is to cultivate awareness of context, where you are and what you're doing and what you're about to do, and "do the math" to figure out if those things "line up" or not. If you're in the privacy of the bathroom or your bedroom (assuming you can get privacy in those places) touching yourself is fine. When you get older, you will likely be able to expand your sphere of privacy. The important thing to keep in mind is that it's only okay to touch yourself if you do have privacy.
The best methods I personally know of for improving your body-awareness (so that you can catch yourself before you start touching yourself in public) are exercise and meditation. Also, if you take any medications, talk with your doctor about this, as some drugs can cause "compulsive masturbation" (it would probably get categorized as that in the side-effect profile even if it were just junk-stimming). In fact it might not be a bad idea to mention it to your doctor (or counselor / therapist / social worker, if you have one and if you're comfortable discussing such things with them) anyway, since it seems to be causing you some anxiety. If nothing else your doctor (or other professional) might be able to suggest some better techniques for managing it.
_________________
From start to finish I've made you feel this
Uncomfort in turn with the world you've learned
To love through this hate to live with its weight
A burden discerned in the blood you taste