Are you confusing "Loopback test" with Loop guard?
MSTP includes Loop Guard, if you have it enabled. RSTP probably doesn't. As far as I know there is no specific configuration for enabling Loop guard, just enabling MSTP enables it.
Also, patching two switchports on the same switch into each other is not what Loop guard is designed to prevent. STP takes care of loops on the switch, Loop guard takes care of remote loops.