The shipped CharacterController is located in the
UnityEngine.PhysicsModule.dll. Now depending on the IDE you are using, you could still take a look at the source. For Rider the shortcut to search for everywhere is double left shift. Entering CharacterController and opening the file is decompiling as good as it can for a readable format. That does not mean you can make changes to the file and expect it to work.
But after taking a look at the soure, you will notice that there is no actual logic in the Controller. A quick google brought this one up: Source for CharacterController where the post claims, that Unity is just using the PhysX from the physics engine and wrote a wrapper for it.
You could now write a wrapper for the wrapper and just cherry pick the functionality you want or go right away with your own CharacterController. If you want to take a look at the full source of it, it should be available here: NVIDIAGameWorks PhysX