Liability Insurance - What if you break the law? Are there any insurance policies out there that cover you if you have an accident while say, jumping a red light or cycling the wrong way on a one-way road?
Note that 'liability insurance' is for damage you do to others, and 'personal insurance' is for damage you sustain. So your title suggests you want cover for, eg, running into a Rolls Royce when jumping a red light, while your question body suggests 'what happens to me if I go round the barriers and ride under a train?'

It's almost impossible to find insurance for illegal activities in general, and often even for non-causal/incidental minor infringements. That makes sense if you start from the extreme cases "I want to insure my house before I set it on fire" or "I want to buy life insurance before I kill myself" and work backwards until you find a nice easily-defended place to draw the line... "it's illegal so you're not insured".

Your normal cover on just about anything (per Matt) should give you some liability insurance and it may well pay out if your infringements are not considered relevant. But if it goes to court you will almost certainly lose because the other side will be very keen to point out the law-breaking.

For personal cover it's harder. There's are lots of UK articles about how to invalidate your car insurance by breaking trivial laws, like this one but they are all very careful to say "might invalidate" or "may cause insurer to deny". So if you, say, are on the wrong side of the road, hit a pot-hole and go over the handlebars you could well be covered because you would probably have been hurt even if you were obeying the law. But if you hit that Roller above and wreck your bike you're unlikely to be covered for anything and Murphy's Law says the Roller will have a QC behind the wheel.