Steam won't be able to recognize where the game data is stored until after it is installed and you input that location.
so formatting it's parent drive and reinstalling Windows won't affect that game data.
you do want to make sure that Windows installation doesn't make use of this drive and/or create any system partitions on it.
so make sure the NVMe is the only drive attached while performing the new OS installation.
have all my steam games on my D drive, a HDD
one thing i would add;
if you are playing any type of modern/demanding games you would be much better off getting a good SSD to install your games to.
startup times, loading times, even rendering speed can be increased with faster access to the game data vs an HDD.