I too can confirm this issue with my Surface Pro 9!
As others, I already had the first SP9 and returned it again for a refund, after online support gave up fixing the issue - we tried everything mentioned here, including running diagnostics, reinstalling drivers and reinstalling Windows 11, all with no results. So concluding it was a hardware issue, rather than getting a refurbished SP9 back as the repair, I returned the device. Immediately afterwards buying another new SP9 expecting it to be an individual hardware error, but found the new one had exact same issue right on first usage.
Can also confirm the mentioned workarounds that are impractical and goes against the whole reason of buying a Surface Pro as a 2-in-1 device of laptop and tablet. Either flipping the keyboard backwards first before removing to trigger the tablet mode. Or switching the SP9 to standby or hibernate and turning it back on will make it go into tablet mode, if the keyboard is not attached when resuming. So definitely, the device can detect the keyboard has been removed - as also confirmed by one other post of device manager showing the removal of two keyoard devices.
One new thing I can add is, that I had a fully working Surface Pro 8 to compare and test with also. Swapping keyboards back and forth between the two confirmed, that neither keyboard would trigger tablet mode on removal on the SP9, and both keyboards would trigger it on the SP8, confirming the issue is with the tablet or software / drivers, and not with the keyboard.
Received my second SP9 yesterday and now torn if I should return that also for a refund, unless there's very quickly a very strong statement this issue is recognized, reproducible and will be corrected ASAP. This functionality is core to why I chose a Surface Pro over other device types.