Try and break this down into components.
I am sorry for your loss
things still feel raw.
Maybe DD wasn't being a cherub today, maybe you were ambitious taking her to the coffee shop. Or maybe you needed a change of scene and it was just unfortunate that DD was giddy and being a fractious toddler. As others have said, ^^ very typical at her age.
At home you can walk off and count to 10. Difficult in a public setting. You can try and gain her attention, eye contact, quiet voice, threaten to go - but you have to stick to it.
A law of parenting: at the crucial moment when you least need a judgy outsider, one will pop up. Sometimes they're not judgy, sometimes they are sympathetic. It is either water off a duck's back or today you were sensitive.
You did the right thing when you decided 'enough already' and left. DD won't suffer for leaving prematurely. It is maddening after dragging yourselves out but truthfully you only waste energy trying to correct or win when they're in that mood. A consequence of messing around if she doesn't listen to you is end of activity (café, rhyme time).
I agree too with the comments above - you saw other DCs being angels but you just saw a moment in time. Those same little people were probably vociferously rejecting their breakfast or hating putting on their favourite clothes or screaming at being strapped in on their journey to the library.
Grief does horrible things to us, it lingers long after others 'move on' and we move through treacle. How are you sleeping? You'll work through this, no shortcuts I'm afraid, cut yourself some slack.