This issue is happening because HDRP calls AssetDatabase.Contains() in it. This call has been removed in 2023.2 and future, so issue is fixed since 2023.2.
Unfortunately we can't backport that fix to 2023.1 and 2022.3, so AssetDatabase.Contains() will continue to be called on those versions. But internally we were unable to reproduce the issue that AssetDatabase.Contains() takes long, for us it was very fast on both Windows and Mac. We tend to think that it is something related to user's machine/setup.