Not sure if you need this functionality or not, but if you set the
clickable attribute to the polyline or polygon that you are creating
to false then it should work fine for you again.
The problem would be as you said, the polygon/polyline is being
created over the kml layer that you created. If it has a clickable
attribute set to true it is going to capture the click event as
opposed to the kml layer. This is one thing I miss with regards to
the older api was that the map click event returned the overlay and
the overlaylatlng, now click events just return a simple latlng. In
the old api you could check against the overlay or just pull the
overlaylatlng, but now you only get the latlng of the object you
clicked on. Your polygon/polyline is at the uppermost layer and
therefore it is capturing the event.
As far as I know there is no z-index available yet in api v3 for
polygons and polylines, only infowindows and markers.