TL431 vs. SMPS transient response
The TL431 is well suited for stabilizing switching converters. It is difficult to beat this 3-leg component in terms of simplicity and costs. However, you have to know some of its limitations and needs to obtain the best of its performance:

bias current is of paramount importance and ensures performance. Keep in mind that there is no \$V_{cc}\$ pin on this part which is self-biased from it cathode voltage. The classical TL431 requires at least 1 mA of bias current. Too low a current and the open-loop gain already small (50-60 dB) further degrades leading to a poor closed-loop output impedance. See the below graph to see how it affects the response with or without sufficient bias:


Some more recent devices require less bias like the TLV431 (100 µA) but are limited in maximum voltage. The NCP431 might be a good option but watch the pinout in SOT-23. As you can see in the above picture, you can add bias by adding resistance in parallel with the LED which creates a free current source (\$\frac{V_f}{R_{bias}}\$)

Operating current is also important depending on the output voltage. Indeed, if the LED series resistance is of too high a value, regulation can suffer especially in light load. Please note that this resistance plays a role in a the mid-band gain as well and should be carefully selected. The maximum value it can take on is described below:



Make sure the loop is properly compensated and the TL431 is wired in a genuine type 2 configuration (one single capacitor) as described below. The pole and zero must be selected to cross over sufficiently high (but low enough considering the RHP zero) and, more importantly, you have to measure the open-loop gain once the prototype is assembled. You cannot skip this important point and transient response observation is not enough. When doing so, make sure the fast- and slow-lanes are tied together (see this AN for more details).


As a final note, make sure the optocoupler is well characterized, in particular its low-frequency pole \$C_{opto}\$ which will work against the theoretical phase margin you want. You have all the needed details in the APEC seminar I taught in 2018.