Did you skim the referenced Rule 25? There is a hierarchy governing who gets pulled; better not to fly on a cheap seat or on an airline on which you have little status if you absolutely positively have to get there. If you have to get there, don't book the last flight out. The airlines have quite sophisticated algorithms to recover from large scale disruptions like weather, computer outages etc. It is quite possible that that crew needed to reach their destination in time to get 'adequate rest', which is mandated by law, so they would be legal to crew a flight the next day that was important to the recovery plan. By pissing off one passenger, who likely isn't a very important united customer or he would have had status, they may have saved themselves tens of thousands of dollars by preventing the need to cancel one or more flights the next day.
And the captain of your flight can have you removed for any reason or no reason at all, he has absolute authority over (and responsibility for) the aircraft once that cabin door closes. there are details here that we are not privy to. He might sue, but it will go nowhere
Ignoring that rule 25 is about people denied boarding, not boarded passengers; when I enter into a contract with an airline by buying a ticket, do I get to provide them a list of my rules that they are required to comply with? Plus, even if it was an effective contract provision, contracts of adhesion are largely unenforceable and construed in a way favorable to the non-sophisticated party.
If you think that this whole thing was cost-effective for United you are delusional. Their costs on this will be well into the millions and that is not including potential lawsuit costs.