Subdomain involuntarily redirects to primary domain after logging in or saving
In the settings.php someone uncommented $base_url and put the primary domain of the site as a value. Changing the value into the subdomain I was working in solved the issue.