Is Switch 9th gen though? I don't think so.
It's the successor of a 8th gen home console and a 8th gen handheld console.
Why shouldn't it be counted as 9th gen?
Well, the sensible argument that can be made against Switch being 9th gen is that the generational count is wrong to begin with. The notable 3rd gen consoles Atari 5200, Colecovision and Intellivision have been lumped together with generation 2 consoles due to their glaring lack of success. The Atari 5200 was the successor to the Atari 2600, launched about five years later. So logically, the Atari 5200 and its competitors should be 3rd gen which then in turn increases the count for every generation afterwards. NES is 4th gen, SNES is 5th gen etc.
Consequently, Switch is actually 10th gen along with the PS5 and XSX|S. But I don't think the gaming community - who came up with this categorization in the first place - is willing to rectify this mistake.