An older title called Escape Velocity has almost all of that except for classes. It was first created for the Mac platform in 1996 but the newest iteration, Escape Velocity: Nova is available for Windows. There is also an even newer title inspired by the EV series and is excellent with a bit of a modern touch to the graphics called Endless Sky(it's free). Different factions, governments to ally to. Different ships you acquire either by purchasing, gaining through the storyline with a specific government or faction, or piracy(literally) with different cargo capacity and weapon systems. You can upgrade your ships with new weapons and armor systems that you unlock through playing or purchase from certain locations(think pirate outpost with stolen tech but if you work for the government you can gain it in their storyline). There is trading of commodities between systems. I really liked the game back in the day and played it multiple times because the different factions or government alliances would create a different galaxy in the end where you might end up a pirate Lord, the savior of Humanity, a traitor to the aliens and their honored war hero, or something akin to a god from one race of beings. Some of the storylines are kind of hidden as well where you have to be in a certain place and have done X,Y,and Z before the option appears. Not to mention each system is procedurally generated. You may jump into a system that is being attacked and they ask for help. You may jump into a system with pirates who are waiting for prey, maybe a derelict ship is floating mysteriously with no crew and when you pick up the cargo you gain access to a smuggling storyline. You could even demand tribute from a planet, win a battle against it's defense fleet and now you control it. This turns your reputation there negative so if you lose, you can't land there until you build a better rep with them somehow. I did this occasionally for unfriendly systems (due to my storyline choices) that had specific commodities or parts I wanted to take advantage of.
The game is basically viewed from a top down perspective or somewhat isometric viewpoint. The graphics are basic 2D but with good artwork, the interactions are via text but very well written, each system and spacedock has a different story when you land there. The game has plug-ins available that add additional user created missions, factions, ships, weapons, cheats(easy money missions, make ships available to purchase that aren't etc) including a patch to allow you to run the game at any resolution. Since EV Nova is an older game it defaulted to 1024x768 but a plug-in available on the game's home page fixes that. There are even plug-ins that recreate the other two games in the series. Escape Velocity and Escape Velocity: Override were never available on windows but there are user created plug ins that re-create the galaxy from those two titles using the EV: Nova engine. The game has ultra low requirements so I think it would run on just about anything these days.
Note: Escape Velocity Nova is available here and there is a free trial
https://www.ambrosiasw.com/games/evn/
Endless Sky is available here and its free
https://store.steampowered.com/app/404410/Endless_Sky/