The problem was found, it was the Jenkins Pipeline build job which was breaking, using an incorrect git hash. The Jenkins pipeline makes multiple repository pulls and overwrites some of the environment variables being used.
Sonar was working fine as it should.
A key document found for this insight was this: Commit Id for Jenkins Change Request Builds
Also, noted that for Sonar 8.9 there is a parameter “sonar.scm.revision” for “Overrides the revision, for instance the Git sha1, displayed in analysis results. By default value is provided by the CI environment or guessed by the checked-out sources” that could be helpful. In this project’s scenario the environment variables were reassigned to correct ones.