I think it's actually a common sense exemption comparable to things like the FMLA having a carve out for small persons with a small number of people. FOSS operating systems bring a lot of value to businesses, higher education and presumably California's government, but the many devs who make contributions that create this value on a volunteer basis could feasibly determine that they will either simply refuse to comply with it and pull these OSes from California, or that even if they did want to comply, they have an argument that compliance is simply an insurmountable burden for them to develop and maintain, in addition to maintaining the other features that actually provide the majority of the value.
On top of these, as others have pointed out, it's a trivial for a sufficiently capable user to modify an open source program to circumvent this. Furthermore, there are a ton of FOSS OSes where development is not based in California, and it would be a ridiculous waste of time and money trying to enforce the law on them. I kind of doubt Canada is going to extradite the OpenBSD devs (or at least the folks your donations to the project go to) to face trial in the US on this, for example.
In a way, it's an unusually aware law that lets legislators avoid the egg on their face of passing a toothless law when it comes to FOSS OSes, while still letting them please the "Think of the children!" crowd and squeeze more data and money (in fines) from Microsoft, Google and Apple, who will be subject to the law.
The overall goal of the law is still terrible, but the way they went about making this exception shows a rare understanding of technology for legislators, even if it was due to public backlash and relevant technical input, rather than the legislators suddenly understanding the tech they want to control themselves.