The SR-71 wasn't trying to catch the MIG-25, it was trying to get away--and it worked. The U-2 proved vulnerable to filling the sky with cheap stuff--the missiles were ballistic by the time they got up there but when the sky was full of them the U-2 had no path to safety.

The SR-71 couldn't be defeated by the level of missile spam that Russia was capable of, the MIG-25 couldn't get close enough to catch it and they didn't have a missile that could actually work up there. (You need more control surface up there, but down lower more control surface costs you performance.)

(And the MIG-25 was a maintenance nightmare.)

I suggest you read the book Skunk Works by Ben Rich, to get reliable account about the SR-71 and its relation to Soviet air defenses from the horse's mouth. Besides, it's genuinely well-written and enjoyable book