What you’re talking about is referred to as a compulsory behavior and its something you might want to consider talking to a professional about if it’s gone as far as you pleasuring yourself on commercial aircraft bro.
My cousin Walter jerked off on a plane once. True story bro. He was on a flight to New Mexico when all of the sudden the hydraulics went. The plane started spinning around, going out of control, so he decides it's all over and whips it out and starts beating it right there. So all the other passengers take a cue from him and they start whipping it out and beating like mad. So all the passengers are beating off, plummeting to their certain doom, when all of the sudden, snap! The hydraulics kick back in. The plane rights itself and it land safely and everyone puts their pieces or, whatever, you know, away and deboard. No one mentions the phenomenon to anyone else.