@xytalyst Sims 4 reads the hardware (CPU, GPU, RAM) of the computer it's running on and rates it, then uses the ratings to choose what settings to apply by default. If you're curious, go into Documents > Electronic Arts > The Sims 4 and have a look at the Config.log file: it lists all the ratings as well as your in-game settings as read from options.ini when the game last launched.
The Memory rating is simple, just a question of quantity. The CPU rating is based on clock speed and cores; you can see the formula in GraphicsRules.sgr if you're curious. But there are so many GPUs, and specs can mean so little in certain contexts, that the game just keeps a database of device IDs (in GraphicsCards.sgr) and matches the installed card with its assigned rating. It's a bit clunky but does work for most players.
As a side note, most modern games, and many less-than-modern ones, also rate your hardware, they're just more subtle about it. I've opened the menus of many games and seen my GPU listed right in the settings, so those games are clearly being just as nosy as Sims 4. It may well be necessary too: games do need to know how to interact with the hardware that's running them.