I've checked in a unit test for this issue:
Current test succeeds for in-memory repositories (so the default implementation is now correct). A fix to the RDBMS query optimizer seems to have solved the issue for RDBMS-based repositories as well.
Well done! The bug is resolved. I checked the issue with in-memory and rdbms (mysql&postgresql) repositories.
Issue still (or again?) exists in combination with an RDBMS Sail (tested with MySQL).
'distinct' flag in GrpahPatternQuery object is no longer disabled if the projection contains "value-transforming functions" like label(), namespace(), etc.