In fact, there is direct boolean in entity:
https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.to_be_deconstructed
You could add this to your check for is valid and disable updates to those chests which are to_be_deconstructed, doing it this way is simpler and I think it might work better in the case where a unit is deconstructed, game is saved and then loaded again without it actually being removed yet.
Edit: Tested it locally and it works :D
for uid,chest in pairs(global.infiniteResearchContainers) do --for each force that has built chests
if not chest.valid or chest.to_be_deconstructed() then -- delete chest if not valid
global.infiniteResearchContainers[uid]=nil
else
updateItems(chest)
mat = e.tick%180
-- game.print("Tick: " .. e.tick .. " - Mat: " .. mat)
end
end