Sorry, it's not wrong, but there needs to be some explanatory comment around here.  You're extracting the number of dofs sitting on entities of co-dimension 1.  Which is dimension `len(el.get_reference_element().topology) - 2`.  But in the extruded case, you know you want things of dimension `(1, 1)`?  What if we're not on a 2D base mesh?  Is the better thing not to extract the thing of co-dimension 1 from the base mesh in this case?