Preferred apps are stored in
/data/system/users/0/package-restrictions.xml
Update this file to set default applications as you need. Remember to reboot afterwards to apply the new settings.
It's also worth mentioning that the file seems to be always opened and modified by android on boot, so better check after change and reboot that your settings are still there as it might not always be the case (If there is an error for example).
Also if you set an app as default for some intent and this app crashes, you have to change that XML file again to restore your settings as android would automatically unset an app as default if it crashed.