My daughter experienced this and when I did some research, I learned that children sometimes have to strain just as adults and it very well could have been from being constipated. Also, irritation of the lining around the rectum or little splits and tears that bleed are referred to a fissures and are quite common. The fissures are a result of being contipated and the child having to strain to go to the bathroom.
The most important thing is to treat the fissure by applying some cream and providing your child with a diet that will eliminate the constipation so the fissure can heal.
Once I found out that this is common, I felt better and didn't rush to the doctor. Hope this helps.