I know your situation. I am a college student and we are just able to afford a safer apartment. Now that there is section 8 housing, I have to escort my lady at all times when she leaves the house.
Her internship is with the county and she goes to crime scenes at odd hours, groups of 17-20? yo men roam around in groups and it is VERY dangerous for her to be by herself.
A similar situation like this happened to me before I turned 21 and bought my handgun. There were four men on the stairs about... ten feet from our front door. She tried to put the keys in and get inside and just ended up panicking. She is not trained in any possible way and reacted horribly, the door then got stuck (on a bag or something?) and she just nagged for me to open the door. Had she said "honey, there are men coming, OPEN THE DOOR!" instead of "ugh open the door" I would've reacted differently, and quicker.
SO my two cents, your wife acted well. I would've stood near my apartment door to be a barrier between my wife and them personally, as stairs are terrible places to fight. However, you reacted with your gut concisely and smoothly to defuse a situation. Sure theres the legal aspect of it, but don't worry about that in the moment, incorporate that into training and learn for later (ask a LEO, they will let you know what they want to see happen, and its good to know since they will be the ones showing up first). Your wife and family was not hurt and you did not have to shoot anyone, so well done.
Move as soon as possible. Not even for your safety but for the well being of your family. It is draining to be vigilant on a high level 24/7, especially in your home.
"I only regret I have but one life to lose for my country" Nathan Hale
Amendment 2 - Right to Bear Arms. Ratified 12/15/1791. Note
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.