In fact, the reason why the AirTags stopped working is because of a safety feature that some manufacturers are adding to their lithium coin cells to prevent them from being eaten and swallowed by children.
The problem: safety coatings
Button cells might seem harmless enough, but if swallowed they can cause serious health problems–including permanent injury and death (a more graphic description of the injuries can be found here)–in a very short period of time. They are dangerous even when discharged, so care needs to be taken throughout the whole of the battery's lifecycle.
To discourage babies and toddlers from putting them in their mouths, some makers are applying a coating of an extremely bitter compound called Bitrex to the button cell.
And trust me, this stuff is incredibly bitter (yes, I've tried it, so you don't have to).
But the problem is that this coating can be problematic when the button cell is used in some devices.
And one of those devices is Apple's AirTags. Apple even mentions it in the battery replacement instructions.
You could buy batteries that don't have the bitter coating on them, but given how dangerous lithium coin cells are, I wouldn't do this if there's a chance of children getting hold of them.
Alternatively, you can remove the coating. But again, the coating is doing an important job in keeping young ones safe, so I'm very reluctant to remove all of it.
The fix for AirTags that stop working after a battery swap
My solution has been to remove some of it, or just enough Bitrex for the battery contact to touch the metal of the button cell.
You don't need to clear a big patch for the AirTag. Just enough for a tiny contact.
I use an alcohol wipe–a lens cleaning swab or injection swab will do the job–to clean off a small section of the coating. No swabs? A pencil eraser also does the job–just don't pick anything that you're going to put in your mouth afterward!
I find that cleaning about a quarter of the coin cell is enough for the battery to make contact, while at the same time retaining enough of the bitter compound to discourage ingestion.
Then it's a case of test-fitting the battery.
You'll know when the battery makes proper contact with the AirTag because it emits a little tune.
For other devices, it's a similar process of making sure the contacts align with the cleaned portion of the battery.
As for how to keep children safe around button cells, here's what you should do:
Buy quality brands -- these are more likely to use be built to higher standards and use safety features.
Keep batteries in their original packaging until needed.
Keep them out of sight.
Only remove a small portion of the bitter coating, and only do that if needed.
If devices have safety features on the battery compartment–such as screws or tabs–make sure to refit them.