It seems mapnik has no easy way of supporting the layer tag as used in osm.org. Only possible way is making a rule for every motorway/trunk/primary/secondary for every single layer level. Idea is to indicate in osm.xml which tag to use. Something to keep in line with textsymbolizer like . Mapnik then knows when a line is above a line without many rules in osm.xml, keeping it thus simple to modify afterwards.
[tomh] The layer tag is handled by osm2pgsql using it to assign a value to the z_order columns in the database and the mapnik stylesheet then sorting query results by z_order.
see also https://github.com/mapnik/mapnik/wiki/Grouped-rendering