Harry Kane has rescued Bayern Munich from an embarrassing home defeat to the last-placed team in the Bundesliga.