Detecting Zero Crossing of Mains (Sine and Square Wave)
How about using a dual opto-isolator and putting the input diodes in inverse parallel. No additional parts compared to your top diagram other than a second pull-up resistor. 

You could then deal with the two crossing signals separately with two MCU input pins (it would be possible to reduce it back to one but in this day and age, probably not a worthwhile exercise). 







simulate this circuit &ndash; Schematic created using CircuitLab