Proportioning valve could cause this or master cylinder not bled properly.
If you replace the master cylinder, be sure to follow instructions on how to pre-bleed the cylinder.
If there is air in the front brake system, the rear will be doing most of the braking.
If bleeding the brakes does not work, you are left with proportioning valve or master cylinder replacement.