There was an issue with some 2009/2010 Corollas and 2008/2009 Scion xD that experienced either poor braking performance or excessive pedal travel. Especially in colder climates (cooler weather) and/or infrequent driving - excessive moisture in the crankcase could get pulled past the PCV and clog the brake booster vacuum port. In a sense, it causes the brakes to loose a portion of the power assist. I've also run across this just recently with our company truck (Tundra) - where the pedal will sink very close to the floor or there is excessive brake pedal travel. If you "pump" the brakes and the pedal feel / braking performance improves - then a clogged vacuum port is likely on of the culprits. Pumping the brakes is generally frowned upon, as this could "confuse" the ABS system, depending on the situation. But is an easy enough test to do by the owner. Find a long, straight section of road, preferably free from any traffic - get up to speed, atleast 20-30MPH or whatever you feel safe with, conditions allow - stop normally, note how far you've traveled and how much force is needed to come to a stop, note pedal feel / pedal travel. Can repeat to see if the stopping distance and feel is repeatable. Then redo the test - but this time, "pumping" the brakes briefly before applying normal brake application. Note anything different in braking distance and feel.
Problem is reproducing it for the technician to diagnose it - scanning the computer does absolutely nothing and IMO a slap in the face of good diagnostic work. Technicians should use computer scanning as a starting point, the real diagnosis comes from having an intimate knowledge of the system and methodically working through possible problem areas. The method of pumping the brakes or not should have been high on the technician's list of things to do during a test drive to replicate your braking issue. If the technician just scanned the computer, without test driving the car - they did NOT do their job correctly. Also being intermittent and seemingly affecting only some Corollas and not others - also makes it hard to pinpoint. Take it in to the dealership and have them double check the PCV system and the brake booster vacuum port.