It looks miraculous. However, one may also adopt a less religious attitude to those "coincidences".
Well, they're not coincidences at all. They're provable mathematical facts. One can explicitly show that the relevant consistency conditions - such as the absence of ghosts - are satisfied by bosonic string theory compactified on any torus of dimension 22 or lower. These no-ghost theorems are even parts of some textbooks.
(Other, more special consistency conditions, such as stability of the vacuum, clearly fail in bosonic string theory.)
Also, it can be showed, using the spacetime perspective - effective field theory - that in 3+1 large dimensions or higher (as you correctly clarified), charged spin-one bosons may only consistently interact if they're a part of Yang-Mills theory.
So in this way, combining the two totally mathematical steps above, one can prove - and indeed, string theorists have proved - that all unimodular lattices in 22 or less dimensions are a part of a root system. (Jeff Harvey, in the other answer, strengthens the statement of yours: you wouldn't get a contradiction even for 23- or 24-dimensional lattices because the shortest nonzero vectors in the lattice already correspond to massive particles. But I will only talk about your more modest statement that assumes that the dimension of the lattice is 22 or smaller. I would also have a problem with your condition of "unimodularity". You really want to study lattices with many $p^2=2$ points and no other condition or, if you want to study both left-movers and right-movers, the discussion is about even self-dual lattices in $d_{22}+d_{22}$ dimensions. But let me focus on the philosophical content here, not the technicalities.)
One could transform this proof into mathematical jargon that will hide all the traces of its stringy origin: but it's still true that string theory is a natural engine that produces remarkable proofs of many amazing facts in mathematics. It tells you how you should optimally proceed if you want to prove an important theorem in mathematics. So what you call is not an "accidental coincidence" - it's a deep, not-at-all coincidental sharp mathematical theorem, and it can be proved by stringy physics-inspired methods.
So this string theory approach also proves a metaphysical statement - namely that this observation is pretty important. It is not an irrelevant coincidence. It has a deeper meaning. Your opinion that it is just a "coincidence" has been falsified. In the same way, your expectation that this "coincidence" may only be proved by checking the lattice one by one has also been proved incorrect. It's a qualitative statement that has a qualitative, conceptual proof - even though this fact may have failed to be self-evident at the beginning.
It's not necessarily the case that mathematicians must first think of all possible structures, all possible theorems, and all possible proofs, and these results are then used by physicists to describe the physical world. When physicists are working on a theory that is as deep as string theory, the chronology is often the opposite one: they're finding structures, theorems, and/or their proofs that are unknown to mathematicians of their time.
Needless to say, such things may occur with physics models that are easier than string theory, too. Witten has used Chern-Simons theory to prove various things about knots and other things. In string theory, those results are omnipresent. String theory produces lots of such results that would look like "accidental coincidences" i.e. "miracles" to a person who doesn't understand any string theory.
Let me mention one not-too-quoted but amazing example. There is an identity between sums of products of Bernoulli numbers that was unknown before 2005:
http://arxiv.org/abs/hep-th/0511286
Look at equation (B.5). It is similar to the Euler-Ramanujan identities. However, it's true and Martin Schnabl discovered this identity - that can be proved (or, at least, certainly checked) once we know it's true while he was solving open string field theory for the disappeared bosonic D25-brane. So this seemingly "miraculous" or "accidentally coincidental" identity follows from the fact that "the space where the D-branes has totally disappeared solves the equations of motion". By reparameterizations that only look natural with the whole string-theory cannon, one may reduce these identities to some much more obvious, but more formal, identities.