An Australian academic and ex-Taliban hostage has died in Afghanistan after battling cancer “for a long time”.