Warm up, warm up, warm up. To avoid serious arm pump you need to do at least 15 minutes of EASY climbing. That's 15 minutes of you doing what you feel is exceptionally easy, even if that means doing traverses back and forth across the wall, or climbing up and down a step ladder. You want to activate your muscles and get the blood flowing so you can displace any lactic acid that will build up when you start to climb hard.
The best warm up I ever had in my life was when I was in university taking a sculpting class. I spent 8 hours straight carving a plaster sculpture of my fist then went climbing right after. There was nothing I couldn't hang onto. Hours or carving had warmed my arms up so well that it felt like they would never fatigue, I was pulling on some of the hardest crimpy holds to hang onto and never got close to getting pumped all night. It was amazing.
Similarly, there's an event the University Climbing Club does called "The Everest Challenge" where teams climb the elevation of Everest on the climbing wall in 24hours. All the teams get to the point where they feel like they could climb indefinitely. They climb the easiest routes the whole time, and after about 30 laps they're pretty warm and keep going all night.
The point is that warming up needs to be slow and easy. You can't rush it, you need to take the right amount of time to get yourself ready for climbing.
Another tip for preventing arm pump is to relax when you climb. Don't try to juice the holds, find a good stance and focus on your balance so you can take a lot of the weight with your legs instead of with your arms. People with bad technique pump out way faster than climbers with good foot work.
If you feel yourself start to get pumped: stop climbing, relax for a bit, and let your arms hang while you gently massage them or swing them around to try and get more blood flow through them. You need to treat the pump before it gets bad, then perhaps spend some more time gently warming up.
Stretching isn't the best thing for arm pump, stretching is better for arm fatigue, which is different. For pump you will have more success rubbing, kneading or shaking your forearms to help clear the lactate.
One thing I would do in bouldering competitions when I started getting pumped, was to run lines on the floor. Arm pump is caused by lactic acid build up in your arms, so increasing blood flow will aid in clearing that lactate, and upping your cardio is the easiest way to get your heart pumping and get that blood flowing.