Theoretically, the safest way to route it is filter, then cooler. This should protect the cooler from the junk that the blown engine generates. However, that is no guarantee that you'll save the cooler when an engine blows. I learned this very expensively, many years ago.
The sequence:
First weekend (Watkins Glen)- Blew newly rebuilt engine. Installed spare. Blew that in ten laps. Ended weekend.
Second weekend (Road America)- Started losing oil pressure every session - bearings going away. Replaced bearings three times. Started race dead last with 6 total laps of practice. Passed 6 cars on first lap, before spinning out. At the Kink! And I didn't hit anything!! Stalled the car and ended the race there, which is just as well because the bearings were going again. Asked Dodge expert what could be going on. He said - "Replace the cooler". I knew this couldn't be right because the filter was before the cooler and thus protected.
Third weekend (Topeka) - Still losing oil pressure and kill a crank. Start race on my last spare block. Decide, "What the heck" and run the race with the cooler bypassed. Problem goes away.
Bottom line - If it blows up, replace the cooler, regardless.