If someone starts blowing up satellites it’s pretty much game over for space based communications.
Not true. China has taken down 2 US satellites in the last few years.
The military is shifting toward LEO constellations for communications such as SpaceX Starshield. Kessler syndrome isn't a serious concern for those because the orbits decay fairly quickly anyway.
Could they place a giant electromagnet in space to collect debris?
Kessler is often overplayed. Kessler trashes a low orbit and you wouldn't want to launch more birds into the trashed orbit. But, loads of com sats live in MEO or GEO, which is far too high for the numbers to work. They're all fine.
You will even see Kessler cited as some sort of barrier to leaving, which is nonsense.
Imagine there's a 1x1m spot where on average once per week, entirely at random and without warning a giant boulder falls from the sky and if you're there you will be crushed under the boulder. Clearly living on that spot is a terrible idea, you'd die. But merely running through it is basically fine, there's a tiny chance the boulder hits you by coincidentally arriving as you do, but we live with risks that big all the time. If you're an American commuter for example that's the sort of risk you shrug off.
Likewise, Kessler isn't a barrier to leaving, humans won't be leaving because there's nowhere to go. The only habitable planet is this one, and we're already here.