Don't requiring ordering streets by layer=* at low zooms
Features are ordered by the so-called z-order value which is computed from road class, OSM layer=* , bridge=* and tunnel=* tags.
At low zooms (e.g. z5) the layer=* tag stops being important and we want to order by only kind. This allows greater line merging for fewer features as well as additional simplification.
The issue is a bit wider than I had realized.
If we look at what OpenStreetMap Carto does, it's z-order comes solely from road/rail class and construction tag.
It doesn't use layer, bridge, or tunnel.
If we look at the OSM-Carto overall ordering, for z10+ it's by layer, z order, service tag for railways, access, and surface[^railandroad].
No where is tunnel or bridge used for ordering. In fact, it can't be. With how Mapnik is built there are multiple Mapnik layers with roads filtered by bridge and/or tunnel.
What do we want this to say?
[^railandroad]: There are complexities around features that are both rail and road which are better discussed in #44