(most of this first part is from Wikipedia so take it with a grain of salt)They store two trains at stations during the night. In order to transfer to a spur line, there is a MAPO override button. Not sure how the two could be connected.
[pure speculation]
The only scenario playing out in my mind right now is that for whatever reason they were operating with passengers at two in the morning, one of the monorails had already been staged and in order to offload the people, the operator was cleared to MAPO override into the station and either misjudged the distance/speed, or there was a failure in the monorail itself preventing it from stopping safely.
[/pure speculation]
The switch that allows trains to move between the Epcot loop and the Magic Kingdom loop is after the Ticket & Transportation Center (TTC), so the operator of the train that rear ended the other train should not have been operating yet with MAPO overridden. He should have done that while in the station or perhaps shortly after that.
As for why there were passengers on one of the trains, because of the holiday the Magic Kingdom was open until 1:00 AM last night July 4th. Monorails and other forms of Disney transportation always operate until at least two hours after the last park closes. During the winter months when the park closes early at 8:00 PM, the monorails usually run till at least midnight.
[speculation] Now, since this was the Epcot loop, my educated guess is that the train in the station was loading passengers who had been at the Magic Kingdom and had taken the MK train to the TTC and had just transferred to the Epcot bound train to return to their cars parked over at Epcot. The arriving/rear ending train I would figure was empty, since I can't imagine why there would be anyone coming from Epcot over to the TTC, since Epcot had closed hours before.
What was to happen with that arriving train is anyone's guess. It could have been the next Epcot bound train; it could have been headed for the barn.
Finally, while I won't swear to it, I would expect that the two monorails parked in a station overnight either spend the night in either the MK station or the Contemporary Hotel station. The TTC is too far away from the employee areas to be of use for storage IMHO. And to some extent, it's an unsecured area.
[/speculation]
And the reason that two trains get stored in a station, assuming that part is true and I think that it probably is, is that when the original MKC-TTC loop was built, they only had 10 monorail trains and therefore the yard was built to deal with 10 trains. When WDW brought the MARC VI's from Bombardier, they brought 12 trains.