That's exactly right, "programming" was considered secretarial work, and guess what, pretty much all secretaries were women.
Male engagement in programming exploded with the advent of personal computers in the 80s, and female engagement chugged along at the same growth rate as before.
https://nces.ed.gov/programs/digest/d12/tables/dt12_349.asp
The "programming as secretarial work" happened in the 50s and 60s which predates this data, so I haven't found a canonical source for that.
It can also be the case that the whole thing is a dynamical system (for example driven by desire to work in a field which already has majority in the same gender), and it somewhat chaotically "oscillates" around the equilibrium. So there really is not an causal explanation as such.
Wait – I thought back then (1950s/60s/maybe 70s), "programming" refered to something more akin to data input, i.e., someone designed a program, and the "programmer" entered that program into the computer's memory, using punch cards or whatever [1]. Later, this activity and the designing of a program was merged and done by a single person, as it is known today.
If this is true, then the mystery is not why women's preferences changed since the 1970s, but why their preferences seem to be different from men's, back then and today.
[1] You can still find this terminology in the hardware world. For example, storing the bitstream into an FPGA's SRAM or flash cells is called "programming the FPGA", and the little box which is sometimes necessary to do this, is called a "programmer" – which is kind of funny if you think about it.