When you reformat your PC to factory settings, the operating system (Windows 10) will be reinstalled fresh. This means that any existing settings, including the Read-Only attribute on directories, will be reset to default. After the reformat, you should no longer encounter the Read-Only issue on your directories.
Regarding the "WindowsApps" directory that appeared on your D: drive, this directory contains software installations from the Microsoft Store. Usually, this folder is on the system drive (usually C
because it's part of the Windows installation, but in some cases, it might be moved accidentally or intentionally.
During the reformat and reinstallation of Windows 10 to factory settings, the "WindowsApps" folder should be...