It was answered in this thread: https://github.com/dotnet/aspnetcore/issues/60680
Key is to add explicit statements in .csproj:
<PropertyGroup>
...
<StaticWebAssetBasePath>_content/RazorClassLibrary1</StaticWebAssetBasePath>
...
</PropertyGroup>
<ItemGroup>
<None Include="wwwroot\**\*" Pack="true" PackagePath="contentFiles/any/net9.0/wwwroot/" />
</ItemGroup>