The situation as I see it is as follows:
The first definition you give is the natural one. It implies that D-modules on the $X$ are given by sheaves of modules for the sheaf of algebras $f_\ast D_X$ on $Y$. However, I am curious if there are actually any interesting examples of such a morphism. Projective spaces and flag varieties don't live in interesting families... Is it then the case that any D-affine morphism is either affine or a product $X=Y\times Z$, where $Z$ is $D$-affine?
The second definition is far too weak. For example, under that definition, if a scheme $X$ is D-affine over a point then any D-module on $X$ is a local system. I think the only schemes that are D-affine in the second sense are finite collections of points.
As you remark, it is not true that D-affineness respects composition. For example, take $X$ to be the total space of $\mathcal O(1)$ living over $Y=\mathbb P^1$. Then $f:X\to Y$ is affine and $Y\to pt$ is D-affine. However, $f_\ast \mathcal O_X = \bigoplus _{n\geq 0} \mathcal O(-n)$, which has higher cohomologies. So $X$ is not D-affine (over a point).
To me D-affineness is a strange and mysterious thing. Flag varieties are D-affine for very different reasons than affine varieties. Perhaps it is not helpful to include both these things in the same definition. Being D-affine is somehow not a notion that is intrinsic to D-modules: I don't think it can be expressed just in terms of the de Rham stack $X_{dR}$ and D-module functors. It is defined in terms of the forgetful functor to $\mathcal O$-modules.
I hope this helps!

