When I’m doing something complicated in or around the engine compartment w/my Corolla I’ll usually just remove the battery as a course of doing the job. It usually pays off b/c I have more room to work, and can see down through that area from above, which is helpful even when removing something like a front drive shaft for a cv joint repair. Besides the battery I’ll often also remove the air filter housing and the entire intake rubber boot stuff right uup to the throttle body intake. It takes such little time to do all that, that it usually pays for itself in spades in making the job easier and faster to do. @wentwest 's comment could certainly apply to this situation.
It’s also possible some connection or another didn’t get re-connected properly. Besides the battery I mean. Esp if they got the connectors on backwards or something, that could create a parasitic drain which would discharge the battery.
And of course it could be a coincidence, and the battery was about to die anyway. But no need to guess. Any good shop can do a charging system and battery test for you, and test for parasitic current drains.