Your solution is a good one, however, you need a computer "literacy" test first before implementing something like mandatory classes.
One of the prevailing theories on why boys dominate the field is due to the fact that they have had more exposure on their own time (in essence have done "self study" work in the field). When schools finally begin offering classes in computers, it is typically 6th grade and later. At which point, many students who have been exploring the field on their own know significant more advanced skills than ones who are only just being introduced to it for the first time. And in schools that teach for the "majority" of students, they will skip past a lot of the more "basic" things because it is below the average skill set of the majority of the students in the course, with the students who don't have the basics down getting lost and as a result discouraged from the field. The converse is also a problem when the schools try to teach to the students with the lowest skill sets in the course. The ones who know it already get bored, complain, and ridicule the students who don't know how to do it so they can speed up the classwork to get to things that meet their skill level.
The real solution is something that school officials and state legislatures will be likely to want to do. If they truly want to have more equality in computers, they need to start having computer classes in kindergarden/1st grade, with individualized progression for the students (i.e. be able to "test out" of any material being taught). Initial costs to setup a system like this would be expensive, but long-term may be relatively in-expensive. The only way for this to really work would be for a mostly automated coursework up and through programming theory, and object oriented design. Everything being most entirely based on the foundation of "online learning" principals, but on a more individual pacing. Grading would not really happen at all for the majority of the work, simply skill progression in passing and completing projects, modules, and practical exams (i.e. very little memorization of definitions, vocabulary, etc., but actual real world useful skill tests such as being able to create a proper formatted paper/document, creating spreadsheets, setting up and using the computer, basic debugging of computer problems, creating a basic program with input and output, etc., etc...). And because it is all self paced, the students don't become discouraged with both themselves or at the other students who "are slowing them down". But school systems would hate something like this because there is no scoring.