Hi! Some pulling inserters randomly change direction so they don't work anymore and have to be removed and replaced (can't rotate). Good way to reproduce is if you upgrade inserters with the upgrade planner, then every single inserter that's pulling something will change direction and won't work. This is with Krastorio 2.
Snapping issues depend very specifically on exact positioning and often mod interactions - to debug these I'll need a simple example save file with your running set of mods and steps to reproduce the issue
Doesn't your snapping code only work on loaders with 'deadlock-loader' in the order field of that item?
Unless inserter is a code word for loader in this case.