Custom pillar git root

This is a forward ported patch from version 0.17.5. This solves #10826. Unfortunately I don't have the time to set up a full development environment on my computer at the moment. If anyone has the time to test this on `develop` I'd appreciate it. If not, I'll revisit the issue some time in the future to ensure that it works the way as anticipated.