Just like the other post, I've tried doing this in my environment. If I have an attribute with PIPoint reference, the method AFAttribute.RawPIPointPath() gives me the expected path to the PIPoint. I've basically used the code snippet you have posted and implemented my code to get reference to valid element and attributes.
Again, I don't think your code has a problem, maybe we can look at this more if we have your AF hierarchy and we know how you are getting reference to your AFAttribute.
RawPIPointPath should work - I have used this in projects before. If you are not adverse to some regular expression fun, you can extract the tag name in a single line of code:
string name = Regex.Match(attribute.RawPIPointPath(AFEncodeType.Name), @"\\\\(.*)\\(.*)").Groups.Value;
I know I saw this code snippet somewhere else in the forums, but don't remember exactly where now, so I can't give the proper attribution, but it works very well, and will give you what you are looking for here.