The thing is Margaery is one of the smartest in King's Landing, she's basically a female Littlefinger/Varys but less experimented, which isn't surprising, she learned from the best: Lady Olenna. So when the High Sparrow is trying to manipulate her by telling his story, quoting a holy book and allowing her to see Loras, she's not buying any of it, she's been doing the exact same **** to other people. She even says it later to Loras, she knows that being allowed to see Loras is an attempt to weaken her. And it kinda worked.
What Margaery didn't expect was that Loras would be so broken and he probably already confessed that he's gay, hell he maybe even throw Margaery under the bus by confessing that she knew that he was gay. Probably why she resigned and agreed to do the Walk of Shame. None of that was said explicitly but that's what I decrypted.