Endoscopy for Hecke categories and character sheaves