Microsoft made some bets that simply aren't paying off with the way things went with the pandemic and the global semiconductors shortage.
Series X needs a big chip for its APU so the number of dies they can get per wafer is not really high.
On top of that they're forced to split their allocation with the Series S but that console has not a huge demand among core gamers who want the Series X while it's still too expensive for the mainstream market that might be interested to buy it as a cheap entry level 199$ device to play games through GamePass.So the ending result is an understocked Series X while Series S is already sitting on schelves.
Sony's decisions on the contrary are paying off because their smaller APU allows for more chips out of the same number of wafers, they also have much bigger brand and experience in consumer electronics and this is probably giving them some edge in securing components (they get precedence because their orders are much bigger) and on top of that they're using the same hardware on the digital edition so production is more streamlined and optimized.
Smaller APU is going to help a lot in the future when the chip is shrinked down to 5nm to drastically cut costs, make a smaller console at a cheaper price. Maybe this is a reason why Sony expects their best year ever for hardware sales in fiscal 2022.