I am no expert, but I think phdPhD study counts towards residence permit. Because you work as a "scientific researcher", which is a not temporary purpousepurpose of stay. Here Here is the link to ind: https://ind.nl/en/work/Pages/Scientific-researcher.aspxthe link to IND.
Here is the linkthe link specifying which iswhat temporary and non-temporary purposes of stay: https://ind.nl/en/Pages/temporary-and-non-temporary-purposes-of-stay.aspx are.