How should I replace this rotten window header?
You can put in a header and change the window later.
I would say that header is two small for the span to start with so installing a narrower window with new cripples will be better from the looks of it.
Make sure to provide enough support, even though the wood is rotten it can be surprising how much support it still provides.
If using wet wood remember it shrinks, this is a place where I want dry wood on a repair so shrinkage won’t be a problem.