Ok yes its a bug of sorts, or actually a feature that backfires in this case. What gets put in the undo queue depends on HOW you operate things. For example if you actually typed that command in the script editor and executed it then it WOULD diplay in undoinfo. However if you for example change the value in the attribute editor, drag with virtual sliders etc then you get no echo able mel name because the handler is not a mel routine but rather something that short circuits to mel.
Now see its about scope maya restores the script that gets called, not the individual command of that script. It just so happens that the attribute editor/whatever is a script that calls a function/api functions to execute the setAttr, now what gets recorded is this script/caller NOT the actual thing the functionality calls. Unfortunately the thing that gets called can be made in way (api call) that echoes nothing thus your undoinfo makes no sense whatsoever.
So its not related to setAttr per see but the underlying command that calls setAttr. SO setattr works in undoinfo if that is actually what you call directly (try it type your stuff) This is a oversight in how the calls have been made by the programmers. And theres not much you can do about it, without re engineering a lot in mayas core. $gLastAction is the same thing as undoinfo.
You can querry the script editor if you wish tough.