Why can’t girls enter temples during menstruation?

The first menstruation of young girls is a cause for celebration. But why do they have to avoid prayer rooms or use different utensils in the kitchen?