Whether a woman does it for pleasure but does not climax and only releases mazi. Or when a man does it for medical purposes such as prostate massage and also only releases mazi and not semen. Would the stimulation of the anus break ghusl if oneself does not release semen?
The main circumstance about ghusl is appetency. If a man or woman inserts something into anus for pleasure or having sex, it's forbidden in Islam.
If there is health problems and if it's a necessity for health, Islam can allow it but I think this is a exception.
If there is appetency, the ghusl will break. Anyway renewing the ghusl if there is time always better.
Ghusl is obligatory only in certain situations =
After sexual intercourse
After waking up from a wet dream
On the day or night of Jumm'ah (Friday)
When a person dies, but depending on how they died.
Outside of these, Ghusl isn't obligatory even if it's inserting things up the anus. But I must tell you that's not a very healthy thing to do.
You can do a search on what medical doctors have said and it's harmful effects.