Creating a package in c++: "Path does not map to any roots"

While I was not able to find the source of the error, I was able to get the code working as I intended.
Instead of creating a package that represents a directory and let multiple assets (inside that directory) use the same package, I created a package for each asset that I was creating.
Therefore, I changed the NewPackagePath to something like this for each asset:

FPaths::Combine(PackagePath, TEXT("MySubdirectory"), TEXT("MyAsset"))

Doing so I did not get any more errors and the assets got saved as expected.