Sorry this happened to you.
I’ve learned being an old man, whenever I go on trips to cities with a high pretty crime rate on local trains I take a taxi to the hotel. Not hard to budget for it (one less ticket somewhere, buy a baguette and cheese for meals one day).
The subways here are very Wild West. The reason the guy likely didn’t attack you is the cops seem to know all of these coordinated groups pretty well.
If you must take the train with your luggage. Don’t wear those damn backpacks. It’s a huge “rob me” sign. Use a rolling hard suitcase with a lock, you’ll need it for business trips eventually if you don’t own one yet.
Keep your phone/small wallet (or combo preferably) in front pocket and keep your hand on it. No clue where you are coming from, but this is subway logic 101 in any major city even for residents.