Why wouldn’t it work? Online gaming only requires that a game be able to open network connections to other games.
Developers were implementing network play entirely on their own long before services like Steam existed.
You’re conflating matchmaking and networking. Matchmaking is what saves you from having to type your friend’s IP address into your game to connect to them and helps to reduce the number of situations where you need to manually forward ports. Steam provides matchmaking, not the game server itself.
I don’t know about now, but, historically, any game with a “host game” button had built in support for acting as the game server, because a game server is just a copy of the game that the other players connect to, which acts as the central source of truth when the different PCs disagree on something.