util/framebuffer: fix util_framebuffer_get_num_layers
the existing methodology was to use the maximum number of layers for all the attachments, but this was broken if the number of layers wasn't equivalent for all attachments
instead, use the smallest number of layers for all the attachments so that attachments with fewer layers don't have oob layer access
cc: mesa-stable
affects: KHR-GL46.geometry_shader.layered_rendering_boundary_condition.layered_rendering_boundary_condition_various_textures