I have tested the solution, also including a call to autograd.grad with respect to v, and it seems to work very nicely, thanks!
Out of curiosity: in my case I need to optimize w.r.t. v, meaning that I have to call the JVP repeatedly for separate values of v. In JAX we have linearize, which is basically a curried version of the JVP:
https://jax.readthedocs.io/en/latest/jax.html#jax.linearize 10
Do you think it would be feasible to do something similar in the new functional interface?