Sorry if someone else has written the this before but children hiding to do a poo in their nappies is a normal stage in many children's toilet training. They will often hide behind a chair or similar, and in your case the broom cupboard. They will also wait until they have a nappy on, usually at night to do the poo.
It is as your GD said, she feels too small to sit on the potty and having all that brown stuff coming out of her is also frightening and puzzling.
One method some people find works is to cut a hole in a nappy and then sit the child on the potty or toilet. With a toilet you need a stool for the feet as it is not easy doing a poo with your feet just hanging down.
I sympathise with you about the 9 month toilet training, the babies are not trained but the mother learns that if she pots the baby after a meal it is very likely to poo or wee. Something in and something needs to come out. This goes all haywire as the child gets older and they have to learn to recognise the signal that they need to go and ask for the potty.
I think it helps in the summer if the child is allowed to run around outside and becomes aware of wetting on the ground not always easy if you don't have a garden. The modern nappies keep the child dry unlike the old towelling nappies so they are not aware of wetting
How does a 'lived experience' differ from an 'experience'?
Acute anxiety after death of my husband