How to get toddler to play alone

My daughter is two, she will play alone ALL day as long as we are in the same room. She will even leave the room and play alone but the moment I shut the door, the loses her freaking mind. She used to play for about an hour after waking up but now she cries immediately. We tried to get her to play alone in her room but she won’t. She screams and pounds on the door. We also tried putting a baby gate up so she could at least see us and she would just climb over it or knock it down.

Edit: for all the rude comments, 2 is not too young. When she wakes up in the morning she used to play for about an hour before wanting out. Or, I’d give her breakfast and put her back and she loved it. It’s healthy for children to play alone. It’s not like I wouldn’t check on her, I have a video monitor and would be watching the entire time. All of my other kids have done this, as well as family members kids. Sometimes showering isn’t an option while she’s napping and the way our bathroom is she can’t be in there with me. She can climb out of playpen and doesn’t have a crib so, therefore some things she needs to be in her room. But thanks for the advice.