This is why people shouldn't have relied on any transaction as being confirmed except those that were showing as confirmed by something that got its info from Bitcoin core.
Since most of the world's nodes and miners use the newest Bitcoin Core there was no problem this time, but if China decided to fire up a bunch of miners using the old protocol then Bitcoin Core users would've been the ones on the wrong chain. This is one of the inherent dangers of forks and why they need to be used as little as possible.
Pretty remarkable our community was almost entirely unaware of this fork, I guess considering the XT backlash the devs didn't want to make it well known publicly until it was already done.
I could (somewhat) easily create a blockchain that is 400,000 blocks long (roughy 37,000 blocks longer then the current blockchain) however in order for me to do this I would need to adjust the timestamps of my found blocks so that the current difficulty would be significantly lower then it is today. This would result in a longer blockchain, but one with less total work then the current blockchain. The chain with the greatest total work is the valid Bitcoin blockchain - this is usually going to also be the longest one, however in my example it would not be.
If miners are mining invalid blocks, then they would be mining on an alt coin's blockchain, and it would not be Bitcoin's blockchain....if this altcoin would have any value would be a separate question.
I think you are right from the point of the view that assuming the miners EVENTUALLY all switch to the 'correct' version, then THAT will become the longest chain.
However, I think turtlehurricane could be correct in the situation where a long chain is built that ignores, say a certain BIP, and then the community decides
to throw that out for now and just keep mining on the main chain that has been built. Either way, its going to boil down to the consensus of the community
and which version they ultimately choose. However, it will be damaging to Bitcoin if at any point there is a long reorg.