Mending Do not create a new link; restore a broken one
Medix2's answer already covers the basics: Mending repairs a single break in a single object, not multiple breaks in multiple objects. However, I want to answer the part of your question about fixing two objects together by hitting them first, then breaking the joint and fixing it with Mending.
So, let's take the specific example he gave, in which he glued 2 pieces of polished steel with wood glue. First of all, I am not convinced that the wood glue adheres to a smooth surface of polished steel absolutely, but that is a real-world question, not a question of D&D rules. So, for the sake of discussion, suppose that wood glue can sickly fix 2 steel surfaces to each other.
Then, create your combined object: 2 pieces of steel glued together by a very weak union of wood glue between them. Now, you break the 2 pieces of steel on this weak joint and then throw Mending to put them back together. What do you get? Well, this is what Mending actually does:
As long as the breakage or breakage is not greater than 1 foot in any dimension, you repair it, leaving no trace of the previous damage.
In other words, undo the damage that caused the breakage or tear, leaving it with the same object you had before it broke: 2 pieces of steel glued by a very weak joint of wood glue. You definitely do not do it get 2 pieces of magically welded steel, unless that's what you started with
Mending It is a limited "undo button"
Here is another way of thinking: Mending It is like an undo button. You can revert an object to a previous state, as long as the current state of the object differs from that previous state in a specific way (that is, the difference must be a small breakage or tear). Mending you can never put an object in a new indicate that you have not been before, how to create a welded steel object from 2 pieces of steel fixed with wood glue.
So yes, in a sense, Mending He really "knows" if the two pieces he is trying to join were originally part of the same object, because he is only able to join them if they really are pieces of the same object. Just like Hold person "knows" what is and what is not a humanoid, in the sense that it only works on humanoid targets. In both cases, the spell does not Really know the difference; It simply fails when you throw it over an invalid target.