Get latest Time Machine backup when backup disk is unplugged
Parse the XML you get from settings - defaults read on the command line:

defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations | tail -4 |head -1


That is a crude way to parse the xml / plist so you could use python or swift to properly read the preference plist / xml and parse out things like the last local snapshot date, last consistency check date, etc...

defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations