I haven't coded any LUA before, but I have done loads of java / C++ / python. Is this feasible? I have found an addon called "BANG ITEM SWITCHER" but sadly this one switches items every time the respective prior ability is used, which means the LoD never comes off ICD and so never procs :(
I can tell you right now that if such an addon were created and Blizzard took notice, they would either modify equipping librams in combat, or impose some other nerf on the whole thing. That's a road you probably don't want to go down...
I was under the impression that Libram swapping in Combat initiated a GCD, thanks to Holy Pallies and Druids doing this back in Black Temple. Isn't the "ideal" Prot Pally rotation already too tight to allow for extra GCDs?
From what I understand of how it was described, it initiates GCD, but is not restricted to it, so a well-timed swap simply "merges" the swap GCD with a spellcast GCD. If that is the case and addons like this become popular, Blizzy will take notice and remedy the situation, probably by not allowing gear swaps during GCD.
I'm not sure how much autoattacks contribute to a prot pally's threat, but the main drawback to relic-slot item swapping is the reset of the melee swing timer. Depending on weapon speed and how often relics are swapped, a player could find himself going several extra seconds without an autoattack swing.
I did several hours of DPS and TPS testing with a similar addon called DruidItemSwap back in patches 2.3 and 2.4 (both before and after the relic swapping change in patch 2.4.2). I found that relic swapping decreased dps in cat form by approximately 13% due to unrealized autoattacks, and decreased tps in bear form by approximately 7%. Granted, feral druids depended a great deal more on white damage back then.
However, I'd recommend some serious testing before releasing an addon that does this. It would be exceedingly difficult to time the swaps in such a way as to minimize swing timer loss, and could easily end up as a net loss if the "wrong" libram gets stuck during a rotation because a swing timer was about to reset.
Also, it's fairly easy to get a swap to coincide with a GCD, but depending on latency and server load (combat event processing "lag"), those tenths of a second can start to add up over the course of a long fight.
Most importantly, the features you're suggesting are really counter to Blizzard's philosophy on decision making during combat. Even if you are able to come up with a solution that provides a TPS or DPS or avoidance boost, Blizzard will change how item swapping works to prevent it. (This is what happened back in patch 2.4.2 when relic swaps were changed to stop any currently casting spells.)