At the end of Avengers: Age of Ultron, we saw Thanos retrieve the Infinity Gauntlet from what appeared to be a safe of some sort as he declared, "Fine, I'll do it myself." That was a reference to Loki and Ronan failure to secure the Infinity Stones for him but the scene no longer makes sense now that we know [SPOILERS] the Mad Titan actually forced Eitri on Nidavellir to forge the Gauntlet for him.
Now, Avengers: Infinity War directors Joe and Anthony Russo have attempted to explain where that sequence fits into things. In fact, Joe has pointed to the scene actually taking place on Nidavellir!
"I think that it would be connected to Eitri," he revealed. "I think that clearly he is the one who forged the gauntlet and Thanos had the gauntlet at that point in time. It's been a while since any of the Asgardians have interacted with Eitri and his people." While Avengers: Infinity War made it sound like Thanos had only recently gained the Infinity Gauntlet, it's feasible he actually did that years earlier.
With that in mind, Age of Ultron's after-credits scene definitely makes at least a little more sense even if it clearly wasn't the plan at the time. In fact, seeing as the Infinity Gauntlet first popped up in THOR, it seems Marvel was never sure where it came from as that was dismissed as a fake in Thor: Ragnarok!