I have that same fence. The problem with it is that it provides lots of toe holes for them to climb over. This type is better at providing not allowing them to climb out. The fewer vertical bars the harder for them to climb out.
She may be drawn to the tree area because it is like being outside and dogs instinctively like going on grass and soil. A lot of my apartment dwellers and elderly customers use a sod pad. I'm not sure if I mentioned that to you or not.
You take a large pan like a kitty litter pan or even a baby swimming pool. You create a platform frame with wire on top. Place newspaper or other absorbent material such as wood shavings under the platform and place sod on top of the wire frame. Since it is grass, your dog will go on it. You can remove solids and can spray the urine so it moves through and down into the absorbent material underneath. This lets you use the same piece of sod for a while before needing to replace it. You do need to replace the material under the platform.
If not a real tree, then it may just be that she is trying to hide her defecation there especially if you got upset with er when you found it there. In a small area I imagine it is evident pretty quickly if she defecates when you are there. You might take some of that feces matter and put a small amount on the pad so she understands that you want it on the pad.
Now you might take a tarp or old sheet or blanket and secure the edges along the top of the fence to stop her climbing out. You might also use some chicken wire across the top or bird netting to enclose the top. Anything to prevent her climbing out.