In other words, "work for hire" (copyright transfer through employment) and copyright transfer through contract are mutually exclusive.
That's not correct. Work for hire can apply contracted for works produced by non-employees.
From 17 USC 101 Emphasis added by me
A “work made for hire” is —
(1) a work prepared by an employee within the scope of his or her employment; or
(2) a work specially ordered or commissioned for use as a contribution to a collective work, as a part of a motion picture or other audiovisual work, as a translation, as a supplementary work, as a compilation, as an instructional text, as a test, as answer material for a test, or as an atlas,
if the parties expressly agree in a written instrument signed by them that the work shall be considered a work made for hire. For the purpose of the foregoing sentence, a “supplementary work” is a work prepared for publication as a secondary adjunct to a work by another author for the purpose of introducing, concluding, illustrating, explaining, revising, commenting upon, or assisting in the use of the other work, such as forewords, afterwords, pictorial illustrations, maps, charts, tables, editorial notes, musical arrangements, answer material for tests, bibliographies, appendixes, and indexes, and an “instructional text” is a literary, pictorial, or graphic work prepared for publication and with the purpose of use in systematic instructional activities.
So a contract can specify the terms under which a work is a work for hire. The terms can easily include a requirement that the client pay up before the work becomes a work for hire.
Note that software does not readily fit under the enumerated works that can be contracted for works for hire.