Solution:
Change the order of your transformations.
Quaternion result = PitchRotationQuaternion * oldTransform * YawRotationQuaternion;
Explanation:
You have an object with a local reference frame. I'll say that +x_o is toward the object's right, -z_o is "forward" and +y_o is "up" with respect to the object. The object exists in the world's reference frame. The world has its own axes: (x_w,y_w,z_w) with +y_w being the world's up. When the object changes orientation, you want it to pitch (rotate around x_o), and yaw (rotate around y_w).
In your code, you create two quaternions. The way you apply them represents rotations around x_w, and y_w. If there is any yaw already applied to the transformation, then x_o is no longer aligned with x_w; consequently, you'll get some roll. Fortunately, for the transformations you're applying, gimbal lock isn't a problem. Gimbal lock would be manifest here by the fact that if you pitch by 90 degrees, yaw and roll become the same thing. But your not using roll; so it doesn't matter.
Your transform can always be represented as a rotation around x_w followed by a rotation around y_w. Putting the new "pitch quaternion" on the left side of the old transform adds it to the other accumulated pitch. Keeping the "yaw quaternion" on the right adds it to the accumulated yaw. So if you were to represent the final quaternion as a bunch or multiplications, it would be a string of pure rotations around x_w followed by a string of rotations around y_w. As long as the object starts of with x_o parallel to x_w, this does what you want.