Robert Lewandowski scored twice, including with the last kick of the game, as Bayern reclaimed top spot from Leverkusen.