Once the factors are known, phi is no longer hidden.
highlighted = computed this step
Factors give phi
Once p and q are known, phi is computed from p minus one and q minus one.
ϕ=(p−one)(q−one)
Subtract one from each factor
The recovered factors give p minus one =4 and q minus one =10.
Multiply to get phi
Multiplying those two values gives phi=40.
4⋅10=40
Summary
Factoring n exposes the phi value needed to recover d.