There is no physical reason why the moon fits precisely within the diameter of the sun.
It just so happens that on our little planet with sentient life, in which human life is present for only an incredibly small window, the time in which we are present and looking to the skies is when the diameter and distances of the sun and moon align so perfectly as to fit one within the other.