لو حلف لا ينكح فلانة وهي أجنبية، كان ذلك على العقد حتى لو زنى بها لا يحنث
If a man swears not to marry an unrelated woman, the oath concerns entering a marriage contract; the cited treatment does not regard illicit intercourse as breaking this particular oath.
The juristic analysis gives weight to the established legal use of nikah for the contract. It does not indiscriminately extend the oath to every lexical association of the word.
This is an example of how wording governs a specific oath, not a statement about the permissibility of illicit relations. An act can remain forbidden independently of whether it violates that particular oath.