Robert Lewandowski scored twice, including with the last kick of the game, as Bayern Munich came from behind to claim top spot from Bayer Leverkusen.