Sorry for went you went through. You flew on a international flight with a kid arriving 90 minutes before the flight. This is to short, if you have ID issues. The same goes for boarding. Why wait until 2 minutes before cut off time, if you have a child and have a ticket with issues... Especially on the way back you should have known better and arrived earlier....
When you book a UA miles ticket, it takes them time to ticket it, probably that the reason the first agent could not find a valid ticket.
I feel bad for you, but stuff happens....