Piastri initially took the lead on the track on merit. Norris took the lead because McLaren, oddly, brought Norris in to pit first and he ended up undercutting Piastri. So Piastri lost his lead because of McLaren’s strategy decisions. McLaren even said on the radio, just before the had Piastri box, that they had brought Norris in reacting to Hamilton, and not to fight or undercut Piastri. So when the undercut actually ended ip happening, they tried to give it back to Piastri because they screwed up. I think it was the right move.
I think Norris should have given the place back early on. Norris had a good chance of passing Piastri on track as he had a little bit better pace. But because he waited until the end of the race he didn’t have the opportunity.