You can use Invoke-SPOSiteSwap to replace root site.
1.After replacing the root site, the url of the source site becomes the url of the original root site.
2.The original root site will have a new url, which is the Archive URL entered when running the power shell.
3.All subsites contained with the source and target sites will be swapped.
Invoke-SPOSiteSwap -SourceUrl https://contoso.sharepoint.com/sites/modernSite -TargetUrl https://contoso.sharepoint.com -ArchiveUrl https://contoso.sharepoint.com/sites/Archive
The url of original root site changed from https://contoso.sharepoint.com to https://contoso.sharepoint.com/sites/Archive
The url of subsite in the original root site changed from https://contoso.sharepoint.com/test to https://contoso.sharepoint.com/sites/Archive/test
The url of source site (Now, it’s being replaced into a root site) changed from https://contoso.sharepoint.com/sites/modernSite to https://wendytest123.sharepoint.com
The url of the subsite in the source site changed from https://contoso.sharepoint.com/sites/modernSite/test to https://wendytest123.sharepoint.com/test