Ah, thanks for finding the lesson. Looks interesting, I think I was looking for an example of such code. Too bad the "drag" code isn't there.
However, "arcball drag" produced a paper describing it https://www.talisman.org/~erlkonig/misc/shoemake92-arcball.pdf which seems useful.
Given the use of quaternions, I agree that reverse engineering the rotations from the transformation matrix is the way to go.
After some pondering about it, it may be less difficult than it seems. That matrix transforms anything, including unit vectors with 0 yaw, 0 roll, or 0 pitch. The simple straight-forward way is to construct those vectors, apply the transform matrix on them, project the result vector onto the plane you are looking at (so both the input vector and the result vector are in the same plane), compute the angle between the original vector and the projected vector, and you're done.
[Everything below is untested, but afaik it should work]
More concretely, let's assume a xyz space, with Z going up, ie yaw rotation is around the Z axis. Also, let's assume 0 yaw is the U = (1, 0, 0) vector (vector should be in the Z=0 plane, for the angle computation to make sense). Apply this to the transformation matrix [1]. Let's assume the answer is (a, b, c). For the yaw, we project the vector to the Z=0 plane, ie vector Y = (a, b, 0).
The angle is computed with the dot-product. Since the dot-product uses length of the vectors, let's normalize Y too (U is already normalized), and create vector Y' with length 1: Y' = normalize(Y) = (d, e, 0). Note this will fail if Y is the null vector. Now you can compute cos(yaw) with the dot product: cos(yaw) = dot(U, Y') = 1 * d + 0 * e + 0 * 0 = d (both U and Y' vectors have length 1, therefore dividing by length doesn't change the result). The yaw can be computed by taking acos(d).
[1] While you can apply the full Transform matrix to a unit vector like U, a simpler way to get the result is just take the the corresponding column of the matrix (x unit vector means 1st column, y unit vector 2nd column, z unit vector means 3rd column).