A few dozen out of how many first grade teachers? Some teachers are just poor teachers, many in my experience were. I can't recall ever knowing whether a teacher was married or not. I do think their personal lives should be kept out of the classroom entirely, but whether we need a law on that I am a bit more dubious.
I don't think it's really enforceable anyway, and it to me is solving a nonproblem, or rare problem. But it makes political headlines and disinformation and avoids trying to solve any real problems that may exist. I could be wrong, this might be a serious issue in the classroom that happens frequently, but it seems to me the underlying issue is these teachers are not proficient as teachers.