This process is called a clean install, which is ironic as there's nothing particularly clean about it: Microsoft has enshittified Windows Setup.
Microsoft has released Store CLI, a new command-line tool that enables developers and power users to browse, install, and update Microsoft Store apps from the terminal.