Fix handling of generating relative path to parent (dotnet/coreclr#18460)
Fix handling of generating relative path to parent (dotnet/coreclr#18460)

Fixes #30263

Signed-off-by: dotnet-bot-corefx-mirror <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>

ptoonen/corefx,shimingsg/corefx,wtgodbe/corefx,ptoonen/corefx,BrennanConroy/corefx,wtgodbe/corefx,mmitche/corefx,ViktorHofer/corefx,ViktorHofer/corefx,Jiayili1/corefx,mmitche/corefx,mmitche/corefx,wtgodbe/corefx,ericstj/corefx,ptoonen/corefx,wtgodbe/corefx,Jiayili1/corefx,mmitche/corefx,ViktorHofer/corefx,BrennanConroy/corefx,ericstj/corefx,mmitche/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ericstj/corefx,ptoonen/corefx,shimingsg/corefx,Jiayili1/corefx,Jiayili1/corefx,ericstj/corefx,ericstj/corefx,ViktorHofer/corefx,ericstj/corefx,Jiayili1/corefx,shimingsg/corefx,wtgodbe/corefx,wtgodbe/corefx,mmitche/corefx,ptoonen/corefx,mmitche/corefx,Jiayili1/corefx,shimingsg/corefx,ericstj/corefx,ViktorHofer/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,wtgodbe/corefx,Jiayili1/corefx,ptoonen/corefx,ptoonen/corefx,shimingsg/corefx