I think I found the answer! if I type this syntax:
>> savepath 'C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m'
then I finally get this result, which recognizes also the pathdef file that is in the \local folder, even though it is shadowes for some reason:
>> which pathdef.m -all
C:\Users\tamarh\Documents\MATLAB\pathdef.m
C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m %Shadowed
After having this progress, the next step was to delete the pathdef.m file from the unwanted location (the Documents folder) and leave only the one in the \local folder.
Then, at last, I get this result:
>> which pathdef.m -all
C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m
I think it is very misleading the whole thing: the unclear differences between string, 'string' and ('string'), and also the fact that the file was shadowed at first, even after I got the correct syntax.
hope this helps someone...