How to merge intersection of an object with itself?
Per the comments, a watertight mesh can be generated using Boolean operations as long as each of the tori in the model are watertight. 

Steps:

1) Start with the mesh with all of the tori. This example was formed by adding a single torus, then using array modifier and applying the modifiers. If you look closely, all of the tori are in a single mesh, but not connected.



2) Add a cube that encloses the tori mesh.


3) Apply a Boolean modifier to the tori mesh. Change the solver to 'carve'. Click apply.


The resulting mesh is watertight and has clean meshes.





Blend file prior to applying the Boolean operation - 



To make the tori a pattern on a solid backing, a union Boolean operation can be used to join these tori to the solid backing.