This addon is an example for developers, whose addons lock files in the addon folder (e.g. an sqlite database). These files need to be removed before the addon is deleted / updated. Especially updating caused some tricky-to-fix bugs, but In the end it turned out to be super simple: Allow access to the db from multiple threads (I wasn’t aware that this was possible) and release it, whenever an addon is deleted.
The addon contains my previous solution attempt, maybe it’s helpful for others in the future.
If you want to experiment with this addon, install it and then lower its mod number (in meta.json). This causes Anki to update.
I added an explanation to __init__py.