I've crafted a full set of armor for Lydia, but every now and again she'll revert back to her circular iron starter shield instead of the one I made for her. The only way I've seen to fix this is to trade with her, take the shield, and then give it back.
Is this merely cosmetic? If not, how can I stop it from happening?
It's a follower bug where they refresh their inventory and re-equip their old gear.
If you have the relevant pickpocket perks, you can pickpocket their old gear out of their inventory.
If you have the console, you can delete their classic items out of their inventory with <refID>.removeitem <item ID> <count>. You can use <refID>.showinventory to list their "true" inventory of items (including the hidden gear).
Sorry, but it doesn't help to have high Pickpocket levels on console. I raised my Pickpocket to 100 for that reason alone. The moment your follower is stripped of the final part of their default armor, they will duplicate and wear a new set regardless of what you had given them. The best thing I found to do was remove all but their shield in any way (you can pickpocket the gear or give them something better and buy the old armor if they run a store) and replace their clothes with what you want. Unfortunately this means you will have to give them a large 2-handed weapon in order to make the shield vanish. DO NOT take their shield in any way after this or they will wear their original armor once more. You PC guys are lucky with your Console Commands. :(
To add to this answer, if playing on the PC, install the UFO - Ultimate Follower Overhaul mod. It has a feature that can "convert unmovable, invisible outfit follower has to regular gear that can be removed so followers will wear whatever player places in their inventory".
This removes the need for the pickpocket perks or usage of console commands on every follower that may have this glitch.