The MSVC /kernel option says:
The /kernel option and the /driver option operate independently. They have no effect on each other.
As such, using it to detect being in a driver is invalid and causes errors due to wdk.h
not being there while building with /kernel
in usermode.
This should be changed to detect the need for driver headers in some other way or an opt-out option should be provided.