When internal domestic politics starts looking iffy...
..then you look for some handy foreign stalking horse to publicly flagellate, hoping your loyalist partisan base overlooks the domestic issues, and rallies against the specter of a foreign aggressor.
The fascinating thing, is that both the principals here are doing the same thing.
Xi is very worried about maintaining his remarkable run of economic growth, now that the West is getting tired of unfair business practices, lies about 'two systems' in Hong Kong, and various pugilistic forays abroad, while COVID19 is putting a serious damper on PRC economic output. He has to keep up delivering the expected growth that got him where he is, or his fortunes may turn south. Having a spat with Evil America is just the thing to brighten up an otherwise not-so-cheery political horizon for him.
Pelosi, meanwhile, has just had the door slammed in her face by the Supremes over Roe v. Wade at home, and wants to buff her cred with a little China-bashing. She's always been keen to parry accusations of being a clueless Democratic Dove, by living out her 'tough-on-China' fantasies whenever and wherever she can. This is another one of those.
In the end, Pelosi is probably right that the CCP is going to do whatever the CCP is going to do, regardless. And Xi is probably right, that his loyal partisans will be successfully distracted by some good old chest-thumping anti-Americanism, especially if it's served piping hot, and fresh.
It's kind of pathetic, if predictable. But well... Here we are.