You are right that dotnet publish automatically does everything dotnet build already does. In most cases – as in your scenario mentioned in the question – that means an additional dotnet build is not necessary.
Do note that you can dotnet build a solution, but should only dotnet publish individual project files. Publishing solutions likely leads to unexpected results (from overriding files of different versions to publishing library projects in configurations that should not be published to the same output directory as referencing applications etc.)
Over time there was a community ask to allow both publishing and testing without potentially rebuilding the app, because some users felt more comfortable only ever publishing an application with the same binaries that have been tested so their build scripts can look like:
dotnet build the.sln -c Releasedotnet test -c Release --no-builddotnet publish the\app.csproj --no-build -c Release