Dual 12V Input sensing switching circut
Your voltage range needs to be converted to something logic-compatible, but that's actually just a matter of voltage dividers.

Get a microcontroller that has a counter unit. STM32F1 and up tend to have these integrated into their PWM unit. You can then do something like "count the events for 100µs". That should do the trick.

You can eliminate the need for a fast counter unit by e.g. using CD4018 CMOS counters to divide your 1MHz clock signal by a factor of N, or you use dedicated clock dividers.

You could certainly use a CPLD with an external &lt;10MHz clock source to implement a 10MHz detector, and a switching state machine.

You could use analog electronics (a bandpass filter) to detect the presence of the 1 MHz harmonic signal within your square wave.

There's pretty many approaches, and your problem isn't overly well-explained – I'd say: pick one of these, try it out, then draw a schematic if it doesn't work and ask a new question with more details :)