Since user profiles are outside courses, changing moodle/user:editownprofile for the student role (normally given in a course) won't work. It should be changed for a system-wide role, such as the Authenticated user role, or in a new role, such as Restricted user as described in Demo teacher role.