I think you are on to something. This is really the critical age when the decision happens. Everything else is the just the result of this.
My own theory, is that CS (programming) is perceived as having low social status. Women are socially smarter, so they are aware of that. Men are clueless, so they are more likely to choose programming and later they move into other CS fields.