I don’t think there is a way to write it “better narratively” since it’s subjective what “better” means. By default, when writing this kind of murder mystery, you’ll have two options: Some preexisting main or supporting character or a new one introduced for the plot, and it depends on what their motives are for why they committed the crime. For this episode, Pinkie was the one who instigated it since she explained the cake in delicious detail, which caused the three to cave in to temptation to take a bite.
I never saw it as out of character anyway since Rainbow Dash, Rarity and Fluttershy sounds like the ones who would commit a crime like that, they’re the easiest ones to give in compared to Applejack who’s been established as being the toughest of the six internally.
Help fund the $15 daily operational cost of Derpibooru - support us financially!