How exactly does that punishment work? I'm a newb doing a mining mission. I just logged on to a guy scanning me and telling me I had 15 seconds to give him all my bauxite before he'd blow me up, so I just logged off again. I don't know if I want to play a game that's going to ban my account for something like that.
When you create a new instance (by logging in in your example) in a ring some random NPCs spawn. Sometimes other miners, sometime police, sometimes pirates as you had. If you have cargo onboard the pirate will ask for some & if you don't comply, will start shooting (ie your ship is in danger).
Logging out in that circumstance will trigger the 'ship in danger' timer, if you wait for that timer to expire you did nothing against the rules (although you could have killed the pirate, run away or given them some cargo).
If you bypass the timer by ending task or some other method that will flag up as an exploit. AFAIK if you do it regularly FDev send you a polite email, if you keep doing it you can get an account ban (probably a few days).