Why are "connection" and "connexion" both used in the same work?
I have come across many instances of connexion in various readings, and based on my experience, I have to say that I have never seen a usage of connexion which would not felicitously be replaced with connection. The Wikipedia page and EL&U question you linked bear this out.
All that in mind, I would say that the variant spellings are almost certainly evidence of non-standardization.
If you really, really want to know, here's the OED's explanation:
Etymology: < Latin connexiōn-em (in classical Latin cōnexiōn- ) binding together, close union, n. of action < co(n)nect-ĕre (participial stem co(n)nex- ) to connect v.: compare French connexion (14th cent. Oresme), Provençal connexio , Spanish conexion , Portuguese connexão , Italian connessione . The etymological spelling connexion is the original in English; in 17th cent. it was supported by the verb connex v.; after the latter was displaced by connect v., the n. began c1725–50 to be often spelt connection , a spelling which, under the influence of etymologically-formed words, such as affection , collection , direction , inspection (all < Latin participial stems in -ect- ), is now very frequent.
The earlier English lexicographers, including Bailey, Johnson, Walker, Todd, Crabb, recognize connexion only. Connection appears in Webster (1828) who says ‘For the sake of regular analogy, I have inserted Connection as the derivative of the English connect , and would discard connexion ’. This preference has been followed by other dictionaries in U.S. Latham would differentiate the two spellings and use connexion only in senses 5– 8 Connexion is the official and invariable spelling in sense 8, and was used in all senses by the majority of writers (or printers) in England until the mid-20th cent., when connection became more usual.