She was pretty horrified in BonBon when she realized what she has done. She didn't try to sabotage their relationship ever. Instead of that she wanted to pull them together as friends. In Just Friends she never acted mean towards them in any way, kept it in, even if she suffered.
She might have kept doing this. Mask her true feelings and keep on suffering because he liked Marco that much and respected both of them as friends, like a mature person. But then Face the Music happened. Ruberiot threw everything out the window with his song. And with that he planted the seed of doubt in Marco. Before that Star was suffering, but at least they kept being friends just like they were back then. But with Ruberiot's song things have gotten weird and unsure between them, no longer the golden BFF thing they used to have.
She didn't want that. So she went back to what she used to: lie about her true feelings and hide it away for the sake of their friendship, so that Marco can be with Jackie in peace. But by the end of the episode HAPPENINGS have accumulated to such a point that she could no longer keep it inside. She couldn't lie to her bestie. She knew where they stood with each other that's why she said she knew he doesn't feel the same way. But the pressure was way too much and she needed some fucking release. She had to clear things up to ease her heart.
I think that the her big reveal in front of everyone wasn't really her being reckless but a way for the creators to push starco further. They could've easily made her drag Marco off somewhere quiet and tell him alone so that nobody else knows about it, but they've specifically made it this way so now, everyone; on Mewni and on Earth (well at least in Echo Creek) knows what's what. Creating more pressure for Starco. It's what they like to do. Tease it and push it as much as they can. I think that was also pretty apparent.