I have a 2013 27 inch iMac that is sitting collecting dust in the closet. This is because it does not contain any ram. Is there any way I could hardwire this to be used as a monitor for my 2018 MacBook pro?
No RAM means no OS and no target disk mode since the firmware checks for memory before the OS gets control.
You would need to physically remove the display and hook up some involved parts that are likely to cost more than buying RAM or even repairing an iMac where RAM slots or CPU are broken.
I love reusing and repairing old gear, but your intended path likely won’t be cost, material or time efficient. Maybe sell this to someone that wants to repair it and put chrome OS flex on it or use it for parts?