I do not understand the usecase for dotnet, since the dotnet SDK self select the correct version to run the project.
You never need to change the version yourself.
On my current machine:
PS C:\Users\username> dotnet --list-sdks
7.0.408 [C:\Program Files\dotnet\sdk]
8.0.101 [C:\Program Files\dotnet\sdk]
8.0.104 [C:\Program Files\dotnet\sdk]
8.0.204 [C:\Program Files\dotnet\sdk]
8.0.300-preview.24118.4 [C:\Program Files\dotnet\sdk]
IMO it's a better way to handle this sort of problem: the SDK self select which version should run, according to your project config.