Sounds like you need to turn on debugging - all the way to developer - and leave it on until reasons for course restore failures are discovered and fixed.
One reason course restores can fail is a missing setting for PHP.
Please see:
https://moodledev.io/general/releases/4.0
Server Requirements .... in particular: 'max_input_vars' setting.
And since you plan to upgrade, please see:
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases
https://docs.moodle.org/405/en/Upgrading
and something to check before each hop in the march of upgrading ... Site Admin -> Server -> Environment Check.
Update the component then set the drop down pick list for Moodle version to each version higher than what it shows you are running to see what issues you will need to address before going t that version.
'SoS', Ken