I preface my question by admitting I know no algebraic geometry nor algebraic number theory. I do know some algebraic topology. I'm a student.

Recently I learned about sheaf cohomology. Then a little bit of etale cohomology, as much as I could stomach having never studied algebraic geometry. Then I came across Artin-Verdier duality, in particular the notion that $\mathcal{O}_K$ is 'like a 3-manifold.' This led me to the interesting area of *arithmetic topology* that wants to understand some larger 'arithmetic $\leftrightarrow$ topology dictionary.'

Now I've done some reading to try to grasp the big picture of arithmetic topology. But I'm unclear on one point:

Is the analogy pursued by this arithmetic $\leftrightarrow$ topology dictionary formal, in any sense?

So far I've seen it said how this analogy gives a nice way of thinking about number-theoretic things with topology (e.g. prime ideals are like links, and their factors are like the constituent knots.) The words 'inspire' and 'motivate' are used a lot. And there are precise comparisons to be made between the objects on either side (e.g. the algebraic fundamental group of $\mathrm{Spec} ~\mathbb{Z}$ is isomorphic to the classical fundamental group of $S^3$.)

But I'd like to know whether there is some larger framework that rigorously explains why this analogy exists.

Exodromy, as developped by Barwick, Glasman and Haine is a rather systematic way to relate arithmetic and topology; see arXiv:1807.03281. It does not explain Mazur's analogy in full yet, but it certainly goes in this direction. This is a great refinement of methods that have been used successfully to study existence of rational points or $0$-cycles over number fields, in the work of Harpaz, Schlank, Skorobogatov and Wittenberg (around the Hasse principle, Gauss-Manin obstruction...); see e.g. arXiv:1409.0993 or arXiv:1802.09605. $\endgroup$