Depending on actual switch construction and specs, either a real safety concern, or not. It may have required creepage, but I doubt so. Most likely doesn't conform to the regulations, but might not be far off; the actual level of danger can be only evaluated by looking at the actual switch.
I guess the gap is much more than "microns"; more likely 1-2mm, with some plastic inbetween.
In any case, not super serious due to low probability of failure; much more serious safety issues do widely exist (such as: using random caps instead of Y caps; or using creepages way below 0.5mm between L and safety isolated side).
The probability is low because, as explained above, the switch in its most typical usage case must be rated to withstand AC live-to-neutral voltage between the legs, and AFAIK, incidents of these kind of switches arcing over between L&N are extremely rare.
Hence, most likely, it won't ever happen that the 230V side would accidentally arc with the 12V side.
This being said, if not specifically specified so, this does not conform to regulations, and for a good reason: the L&N arcing is considerably less serious incident, as it "only" causes a fire hazard, most likely handled by upstream fuses & fire retardants in plastics - the analogue of X caps is the right one. Whereas, when used like the OP describes, L to safety isolated side (12V) connection doesn't give any signs of failure to anyone, and creates a very real death trap by electrocution situation.
So, in all regulations, L-to-safety-isolated-side has much more strict requirements than L-to-N.
So while the chances of a failure are extremely low, the consequences are much, much more severe than what happens when the same type of switch fails in its intended way of usage.