all COM.X modules have an internal DC-DC converter which takes the voltage applied at the external power jack (from 5 V to 12 V) and converts it to 5.4 V (or less).
The M5Stack device (if powered from the COM.X module) always gets those 5.4 V (or less) from the output of that internal DC-DC converter (independent of whether switch S1 is set to 5 V or 12 V). So no, the 12 V are not being sent to the M5Stack device.
The switch (S1) only selects the voltage going to the LoRa board, which can either be the voltage applied at the external power jack (if S1 is set to 12 V) or the 5.4 V output from the internal DC-DC converter (if S1 is set to 5 V).
On the LoRa board itself is yet another DC-DC converter which creates 3.3 V for the LoRa chip. It's hard to find the proper datasheet for this DC-DC converter, but I think its input range is up to 18 V. So feeding it with 12 V should be fine.
I know, it's quite confusing and it took me more than one attempt to figure it out (and I could still be wrong).
I personally set the switch (S1) to 5 V and use an external power supply set to about 6 V. This allows the internal DC-DC converter to actually produce 5.4 V which then is used for both the LoRa board and the M5Stack device.
If you only use an external power supply with 5 V then the internal DC-DC converter will only produce about 4.7 V (which might be marginal in some cases).