WD Blue SSD stuck in a boot loop
A boot loop is not necessarily an issue with the drive and it’s your last sentence that lends credence to this:

Right now I am just back to using my HDD, and it has begun to exhibit the same problem. It goes to the progress bar on startup and abruptly reboots.

A boot loop is when, during the boot process, something loads that causes a system crash that forces a reboot.

Corrupted macOS installation
Corrupted partition maps
failing hard drive
logic board issue
GPU issue
and more

However, your last bullet point offers a bit of hope that it may be your SATA cable (common problem with this vintage MacBook Pro)

Putting the HDD in the enclosure and boot it from there(which works but is extremely slow and I still don't know what to do afterwards)

This means that the operating system and things being loaded isn’t crashing the system.  What you’ve taken out of the equation is the everything between your drive and your logic board (the same drive works via USB) which is the SATA cable.