> My hunch is that any algorithm that analyzes chords in isolation (and not in the context of other chords in the song)
You can at least get much further by naming a key (what a key is, is not etched in stone either, but there are some useful enough definitions for most cases). That would be a bare minimum for a useful algorithm though.
Especially if your input is just a set of notes.
And then the key may be unclear, or musicians may differ as to where they feel, say, modulations occur: "it clearly modulates in measure six" "no, measure six is just a borrowed chord and the real modulation is at the cadence in measure eight" etc.
The way music is written has more to do with tradition and legacy systems than being efficient and correct and musicians like to fight about ultimately meaningless things like time signatures.
Naming a key seems, at the very least, a better way to decide the root note than counting accidentals; but which chords are the preferred, common ones isn't completely clear-cut.
You can at least get much further by naming a key (what a key is, is not etched in stone either, but there are some useful enough definitions for most cases). That would be a bare minimum for a useful algorithm though. Especially if your input is just a set of notes.