It seems you are confusing the function of solder resists as being some form of electrical insulation rather than being a mask that prevents solder going where it shouldn't.
Although not particularly conductive, solder resist should in no way be relied upon as an electrical insulator, especially when insulation is required for safety reasons. The integrity of the resist is simply not integral enough to be relied upon to not have cracks and holes in it, especially after soldering. Further, it chips off easily.
The layer is also very thin and will not withstand much voltage across it.
There are other, better, materials specifically designed for this purpose if you really need electrical insulation.