What can a custom cycles shader do?
Using an OSL script is the closest you can come to modifying cycles without modifying the cycles source code and building your own version. Using an OSL script we can create nodes that perform any calculations we may want to do. These nodes can be incorporated into a node tree the same as any built-in node that exists in blender. You can look at how existing nodes are implemented using OSL. The main consideration with OSL scripts is that there is no GPU rendering support.

An OSL script can be as simple as a math node with a numeric input that does a calculation and outputs a numeric value, or at the extreme an OSL script can be used to create a ray tracing engine that runs within cycles. François Gastaldo created an OSL script that re-creates the old 1986 juggler animation on the surface of an object, he later also created a full path tracing engine - these were made for educational purposes as François is a teacher but serve as good examples of not being limited by how complex an OSL script can be.

If you look at tables 6.1 and 6.2 on page 39 of the OSL specification you will see the data available from the render engine that can be used within an OSL script. Most of the data is read only, we can only alter data such as the location of the point that the ray has hit, the surface normal and the closure that describes the colour used to get the final image. This means we can't directly alter the ray as it passes through the scene or how it interacts with other objects but we can use an OSL script to distort the surface of an object, that should make it possible to connect the camera vector from a Texture Coordinates node to a vector input for your OSL script and use that to distort the surface normal so that it faces the camera.