...provisions such as, "This warranty is void if service is performed by anyone other than an authorized 'ABC' dealer and all replacement parts must be genuine 'ABC' parts," and the like, are prohibited where the service or parts are not covered by the warranty.
... which doesn't really apply when replacing firmware which is covered by the warranty. One might argue that there are bugs, but the fact is that the phone is operating as it was sold, and there are other remedies for non-performance. Alternate firmware is done to change the behavior of the phone, not to return it to its original functional state (cf "replacement part").
No warrantor of a consumer product may condition his written or implied warranty of such product on the consumer's using, in connection with such product, any article or service (other than article or service provided without charge under the terms of the warranty) which is identified by brand, trade, or corporate name
That's there so Hoover can't force you to buy their expensive name brand vacuum cleaner bags to maintain the warranty. It doesn't prevent a manufacturer from setting quality specifications ("use 5W-30 API SM certified oil"). It doesn't prevent a manufacturer from saying you can't do modifications. It just says they can't demand you buy stuff from them to maintain warranty. There's a big difference. Your firmware got corrupted? The manufacturer will flash it again, free, under warranty. If a car maker wants to say they won't warranty the engine if you hang fuzzy dice on the mirror, they can - as long as that's clearly spelled out in the warranty terms - they're not in violation of the MMWA. There's nothing in the MMWA which even remotely says they must prove the modification caused anything. The most obvious place where it would apply to phones is with replacement batteries, if the manufacturer didn't replace them free during the warranty.
If you break the phone (say, by blowing a security fuse while trying to load alternate firmware), it would be hard to argue that the alternate firmware wasn't the cause of the failure.
I sympathize with wanting the ability to modify phones. I've rooted mine, but run stock firmware with bloatware removed, the tethering block removed, and no other mods. Some firmware plays with processor overclocking, which can cause hardware failure. I've seen lots of forum posts where someone "bricked" their phone by modifying the bootloader/firmware, who then go on to describe acting ignorant as to how it happened and getting it replaced under warranty. That's fraud, plain and simple, so I can also sympathize with manufacturer's who don't want to pay for phones broken by users actions.
Finally, from a pragmatic perspective, they'll do what they want, it's going to end up costing much more than a new phone to even bring the issue to court. In Michigan, where the author is from, you can sue a company in small claims if you can find where they have a physical presence in the state, but they then have the right to get it moved to district court, where you'll end up needing to pay for a lawyer. Guess which of the parties has lawyers on retainer? So, in practice, if they don't want to honor the warranty for any reason, they won't.