Please don't loose faith in your dog. I'm sure your baby doesn't do it on purpose. Dogs LOVE attention, whether it's positive or negative. So scolding her is still giving her attention.
When we got Lulu at 13 weeks she was pad trained. We had her enclosed area in the living room, with her pad there. In the first few days she went only on her pad, but then started marking different areas of the carpet. She especially loved to poop under the coffee table, when no one was watching her. We ended up removing all the furniture under where she could hide and potty, but that didn't help because she would still go on the carpet 50% of the time.
So my husband had a brilliant idea.

We made a little alcove around her pad with the doggy fence we fenced off the living room with. After each time she ate, played, or slept we'd put her on her pad saying "go potty," and if she wouldn't go we enclosed her on her pad and didn't pay attention to her till she went. Lulu re-learned her potty skills in one day + the command "go potty". She didn't enjoy sitting on the pad as much as walking around on the carpet and being with us, so she forced a potty sometimes but at least I was sure she won't go on the carpet.
We continued to supervise her and putting her on the pad for about a week, and then she really got it.
We still have accidents and she is under supervision, of course. She is only 5.5 months. And it is frustrating. She'd go a couple of days without accidents, and then I'll find her poop in the hallway

But i know she's trying and that she is still a baby. And if I tr to "translate" the situation into human terms, at 5.5 months, I was far from using the toilet as a baby.....