First, look at the inputs, you need to look at the brake booster. Make sure there are zero rips, tears, or obstructions that could cause a hard or soft brake pedal.
Next, you need to examine the ABS hydraulic control unit or HCU. On higher mileage vehicles, the valve and seats for the solenoid can be stuck or start to leak. The fluid can bypass these valves. When this happens, it can cause a brake pull or a low brake pedal. It is possible to diagnose this with a scan tool before you replace the master cylinder.
Next, look at the outputs. The calipers should not have leaks, a damaged piston, or any brackets that prevents smooth operation.
Finally, Look at the feedback from the brake rotors. If the brake rotors have issues with lateral runout or disc thickness variation, it can cause pulsation that pumps fluid back to the master cylinder. If you look at the inputs, output, and feedback of the hydraulic brake system, you can quickly diagnose if the master cylinder has issues where the fluid is bypassing around the seals or other issues related to the condition of the brake fluid.
This video is sponsored by ADVICS.