Any Neural Network implementations that allow for a cost function of more than just the network output? I have an application of a straightforward MLP, for which the cost function is a function of both the network output, in addition to another value calculated from the network weights (actually the partial derivative of the output with respect to one of the inputs). 

Are there any flexible NN packages where I can code this? The only ones I've seen (Keras, nnet in R) require that the cost function is just parameterised by the network output and the target value.
You should be able to do that in Keras, actually you should be able to do that in almost any flexible package. For example regularization does exactly that, it adds a penalty term to your loss function that punishes high weights.