so the events at Helgen was on my mind a lot. Thanks for this thread, reading your ideas really helped finally shape my own answer, which I'll share here.TL;DR version - Alduin attacked Helgen because he sensed some mortals with the Voice there, but had a hard time telling people apart.
My personal take comes from looking at things from Alduin's perspective. IMHO, actually putting ourselves in his shoes (or claws) is the best way to understand his actions. Keep in mind he's a dragon, so he probably sees things very differently.
Dragons and some people seem to sense the Thu'um, the Voice, in others (even if they don't Shout). Dragons comment on it a lot, "I feel your Thu'um is strong, Alduin's Thu'um lacks rightness," etc. They probably think mortals who have their own Thu'um to be curious novelties.
So when Alduin or a dragon senses the Thu'um coming from a humanoid, it's kind of like a person hearing a parrot speak. It's like, "Oh, for a second there I thought you were one of us, but you're just one of those birds that we can train to talk."
Our Dragonborn characters are not unique in having the Thu'um. The Greybeards in their mountains can Shout, as can elite Draugr or Dragonpriests in crypts. However, those parties never leave their respective homes. They're like parrots caged in pet stores.
So our Dragonborn character is riding in our cart with Ulfric Stormcloak, who also has the Voice (probably from training? I dunno). That coincidence's just weird to a dragon. It's like a person walking and hearing 2 parrots chatting in the middle of the street, totally outside the pet stores they should be in.
Alduin's been active, flying around, "activating" other dragons. Suddenly, he feels 2 Thu'ums gibbering, so he follows our cart to Helgen out of curiousity. He doesn't attack right away, he kind of just checks it out, like "is that a fellow dragon I hear?" THEN he starts blowing stuff up because...
Although for the Nords it's been millennia since Alduin disappeared, for Alduin it was probably just a matter of days or weeks since he was defeated and cast through time. He remembers how mere mortals created the Thu'um Dragonrend, which makes him feel threatened.
Now, imagine you're Alduin, still stinging from being beaten by people with the Voice. You thought you heard 2 fellow dragons, then turns out to be 2 Joor with the potential to speak the Dragonrend again! Not just that, but there's also these other Joor with weapons and armour!
Clearly they are putting together an army to fight me like last time, but never again! I will beat them within an inch of their lives and burn them the rest of the way! ROAAARRRRRR!
So Alduin's attack wasn't to free the Dragonborn or Ulfric. IMHO, I think he was trying to kill them. But with so many people about, Alduin couldn't tell which they were. It's like asking a person with no interest in birds to pick out the parrots and parakeets in a rainforest.
Of course, it completely backfired. Had Alduin stayed back a few more seconds, the Dragonborn would have been beheaded and posed no threat. But the human notion of a execution was foreign to him as a dragon, Alduin had no idea what was going on, so he just attacked as was his nature.
So why did he fly away after that? He probably couldn't sense the Thu'um anymore, as our Dragonborn and Ulfric were running away into cave tunnels and woods, lots of chaos everywhere. He was probably hoping they were the ones he killed, but went off to warn the others just in case.
Just my personal take, but at the moment this is the version that makes the most sense to me, based on how other characters described events before Helgin and the general attitude dragons seem to have on us mere Joor.

Once he got to Helgen however he may have noticed something special about one of the appetizers...

