The original hard drive stopped working, so I got a new SSD (Crucial MX300, 275GB, part number CT275MX300SSD1) to put into the MacBook Pro and make a clean install of macOS.
Installation of High Sierra using an USB drive looked like it went through well, but when the MacBook Pro rebooted, it got to a screen where it just shows a flashing folder icon with a question mark inside.
After that failed, I tried a second time using Network Recovery and installed Mountain Lion. Same flashing folder icon after reboot. NVRAM reset did not fix the issue.
After wiping the drive once again, I immediately ran a volume check using Disk Utility and it told me that the volume was damaged.
diskutil verifyVolume disk1s2:
Started file system verification on disk1s2 Macintosh SSD
Check file system
Checking Journaled HFS Plus volume
Checking extents overflow file
The volume Macintosh SSD could not be verified completely
Error: -69845: File system verify or repair failed
Underlying error: 8: POSIX reports: Exec format error
So maybe the issue lies on the SSD itself?