None of these equations are 'wrong' but all are a little clumsy.
Ryder052, you example does not account certain cases as you've commented. Why not use atan2?
Given unit (normalized) direction vector d
pitch = asin(-d.Y);
yaw = atan2(d.X, d.Z)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…