Executing the command bellow on a any binary file causes the file to be moved as intended:
curl \
--silent \
--fail \
-H 'GData-Version: 3.0' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--request PATCH \
"https://www.googleapis.com/upload/drive/v3/files/$FILE_ID\
?supportsAllDrives=true\
&supportsTeamDrives=true\
&removeParents=$OLD_PARENT_ID\
&addParents=$NEW_PARENT_ID"
However this also creates a new revision where the file's size is zero and the file can't be downloaded or previewed.
Removing that new empty revision seems to solve the problem and preserves the file's new path.
I suspected that it might be because the folders are shared and different, but trying it on a file on the same Drive reproduced the issue.
According to API's reference for files parents:
Update requests must use the addParents and removeParents parameters to modify the parents list.
Am I using the API correctly here?