As far as I know OSM has no data about traffic, just road type. Any sort of mask would require the ability to easily identify an urban vs a rural area, which would be difficult to do. The closest OSM gets is suburb, you would then have to manually classify suburbs into rural or urban, then use logic to exclude street lighting from roads in rural suburbs. Problem is not all areas are desinated as suburbs or have an area you could use for this purpose.
Here is an example of OSM data for one road, Dayboro Road near home. It passes through both urban and rural areas. In reality the urban part of this road is lit, while the rural part is not. But both sections of the road have the same OSM data available, and nothing to differentiate them.
Available OSM data - the description on the left applies to the section of the road shown in orange.
Dayboro Road - Urban Area
Dayboro Road - Rural Area
As I mentioned you could use an area to designate roads that are not to be lit, that exist inside a designated area. In reality the section of Dayboro Road that passes through Whiteside is not lit. Using OSM data it is possible to identify roads that are located within Whiteside. But getting any automated script to make these identifications you would first need to manually classify all areas as either urban or rural, as this data is not recorded in OSM. Possible for small scenery areas but not for the whole planet. Another complication is that Dayboro Road is not fully located within the area designated by the area Whiteside, so may not be identified as a road not to be lit.
People might think Asobo have invented something new with scenery design, but there were already instructions out there how to create photo realistic scenery from Bing (or Google images), create lit streets at night using OSM road data, create houses based on either Bing images or OSM actual house sizes and populate trees into areas based on OSM data or Bing imagery. I had already done this for Aerofly FS2 which is why I recognise the same problems that I had encountered, also appear in MSFS. Like lit streets in rural areas. Asobo just do it so much better, so much quicker, live stream it, for everywhere. This is quite an achievement for even small areas, let alone for the whole planet.
And lastly OSM data is open source. So then is no guarantee of the accuracy or consistency of the data. That is why you occasionally see houses 1000s of feet tall in MSFS, because someone made a typo when creating the source OSM data. When I found this doing my own scenery design, I just updated OSM data with the correct information myself, as anyone can contribute. And therein lies the problem with OSM data.