先贴代码
https://github.com/cocos-creator/engine/blob/v3.4.0/editor/assets/chunks/transform.chunk#L11#L52
https://github.com/cocos-creator/engine/blob/v3.4.0/cocos/core/math/quat.ts#L424#L430
https://github.com/cocos-creator/engine/blob/b11686b4dcb7754cfad8e0a1d71d7649eff62fa4/cocos/core/math/quat.ts#L461#L501

根据 Maths - Conversion Matrix to Quaternion - Martin Baker 中的推导公式

quat.ts 是正确的,而 transform.chunk 中的 quaternionFromAxis 计算的是转置矩阵的quaternion (因为GLSL中是列主序)
axi 又刚好传的是转置,所以转置了两次,刚好结果又对上了。
所以,为什么要写的这么绕呢? 



