Alves at Sevilla is the closest thing to a right back dominating the game from start to finish I've ever seen but he was unquestionably a defensive liability. Just look at the first goal in the 2007 UEFA Cup final (and the acknowledgement from the commentators that Alves isn't a great defender). Terrible positioning to begin with, complete lack of awareness of the danger, and then when he tries to make up for that mistake he dives in rashly and gives Riera all the time he needs to slot it home.
I do think Alves improved his defending 1v1 in his time at Barca so when he was given the task of sticking to Ronaldo he was pretty good at it, but his positioning, awareness and rashness never really changed much IMO, and he was levels below Lahm as a defender at this peak. I don't know how anyone could say their attacking contribution is incomparable either. Lahm got 17 assists at club level just two seasons ago - a feat Alves only managed to better once in his career, and I'd be surprised if any other fullbacks even come close to that number in the last decade. So at his peak his end product was comparable and his build-up play was even better...so I think Lahm's attacking contribution is being greatly understated here.
Lahm wins out because he is a better defender and always was but his contribution to the attack is terrific as well.