If I write code in machine language, then I have access to the CPU in both modes (user and kernel), since the OS is bypassed, correct?
No. The Operating System is going to use context switching and virtual memory to hide the fact that there are multiple processes running on the computer. Native code does not mean you have full control to the CPU registers, global physical memory. Your program, if not privileged, is still running in user mode. You need to use syscalls to do lower level tasks. The operating system provided a virtual and abstract environment for the program to make them convince themselves they are running on a dedicated machine.