Can the nitrogen of an amide displace a primary chloride in a SN2 reaction in the presence of a strong base?
Well it is difficult to compare an intra-molecular reaction with an extra-molecular one because it really depends on the conditions. However, unless you have a very high concentration of one reactant, the intramolecular way will always be favored.

In your question, you consider that "N" is not a very good "attacking group". Well this is wrong. "N" is always happy to attack any nucleophilic group, even if it becomes "N+". However, a "CON-" is much more nucleophilic than just "CONH".

Sodium methoxide here just serves at deprotonating CONH to activate it, but MeONa (sodium methoxide) is not nucleophilic enough to interfere.