However if you look at it from a different angle, things actually make sense. So rather than "Why did he give up his arm then?" or "He always wanted to get rid of it", it's more about "What did Shanks losing his arm mean to Luffy?"
When you look at it from that angle, then it doesn't matter why Shanks didn't choose to remove his arm sooner or whether it was to save Luffy or just remove Imu's influence. The lost of Shank's arm served a major point for the series and that remains unchanged even now, which was a message and seed of inspiration for Luffy about the type of Pirate he'd want to be. This combine with Shank's words to Whitebeard, about giving his arm up for a new era further implies that what Shanks intentions at that moment wasn't about just saving Luffy, or ridding himself of Imu's influence. But more importantly it was to help give Luffy the push he'd need. So Shanks had to lose his arm at that moment and in that situation
That's how I see it too somewhat. Shanks didn't just take the opportunity to get rid of the arm, it's more that Luffy had already done his first act of liberation without even noticing and Shanks literally felt it with the loss if that arm. Him eating the gomu gomu fruit and needing Shanks to save him was accidentally the thing to save Shanks!
Shanks didn't just do himself a favor. He gave himself closure on his plan to honor Roger and bring freedom to the world, leaving that ambition behind with his arm, which tied him down to the WG, and passing on Roger's legacy onto Luffy with the Straw Hat.
In a way, it's fate. The new Nika was born the second its spirit/power entered Luffy, one act of liberation leading him to now carry on centuries of ambition and the legacy of a righteous cause.