Harry Kane scored twice as Bayern Munich ended a three-game losing run in all competitions with a last-gasp victory at home to RB Leipzig.