This is the definition of matrices. Understanding matrices will definitely help you solve this. I recommend watching this:
Linear transformations and matrices | Essence of linear algebra, chapter 3*
As for how to rotate around an axis, in 3D, you can look at how utility method is implemented in JOML:
https://github.com/JOML-CI/JOML/blob/c312304fefbe757e3d37cba866f5742b3448a85c/src/org/joml/Matrix4f.java#L11379
This is generic use case, but now i have to correct you. What you put in the "What is happening" is not correct. Because in both translation, rotation and scaling, coordinates do "the same" what the model does (it is actually the opposite - model does whatever you do to the coordinate system).
That said, the transformations you apply further down in the stack, actually apply to the already transformed coordinates as a whole, so