It might be a better question for a Biology board.. But I believe you are saying the Midichlorians induced Parthenogenesis, which, as a rule, only produces viable female offspring.
Now, the argument that they can't just 'Invent' a Y chromosome makes sense.. but could be argued in the fictional universe. A Y Chromosome IS an X chromosome, just (in layman's terms) missing the end. Therefore, it makes sense, that the midichlorians could just 'lop' off the end of one, resulting in a synthetic Y chromosome. That makes sense... except that although the Y chromosome STARTED as an X (and lost some data over time), after several millennium of separate existence, the two have developed to such a degree that they contain a considerable amount of gender specific info, and really aren't the same thing anymore. (This isn't to say you won't see Males produced by Parthenogenesis; you will, but they are Haploid males.)
Now that I've nuked the easiest argument... My best guess (with no canon backup, so far) would be that the Midi-chlorians used Darth Plagueis' DNA (to a limited degree; he was a Muun, after all -- basically copy her X (exactly as I said wouldn't work, above) then overlay the male specific sections with his) or sampled male DNA from the local environment. Or, given that we've seen Midi-chlorians can communicated with each other over great distances, they could have grabbed DNA from any force sensitive within range, and that range could be pretty impressive.
(On a related note, but addressing a different issue... I've always thought of any consciousness Midichlorians have as being more of an expression of the Collective Unconsciousness more than something that exists independantly in them. That being the case, replicating a Y chromosome would be no problem.)
That's all in-universe. Out of universe? I think Lucas either never considered the genetic angle, or fell for the trap I mention in the second paragraph, thinking that you could create a Y by trimming an X. You CAN, but you tend to get non-viable offspring.