Is it possible to get the file path to the .blend file that a linked object came from programmatically?
Yes it is possible: 

obj.library.filepath


Additionnally, a not linked object has an empty obj.library.