Rear brakes keep locking/ master cylinder

bizarre issue this weekend,
the brake fluid seemed to keep expanding…
the left rear brake lever would get harder n harder to pres, finally, u cant press it anymore and the wheels are locked. was going down the road and it locked. i unscrwed the banjo bolt on the master cylinder to release some presure, that worked, but this happened a dozen times or more all day while riding.

why would the brake fluid expand al the sudden?
calipers are fine, not locked or anything. its the fluid, soon as i open release some fluid, it presses fine then later its like its full again and cant press it at all.