If a miner include an invalid transaction, the block will be rejected by nodes.
Yes, it is correct! When this occurs, it's referred to as a "reorg" or "reorganization". In essence, the nodes will disregard the block containing the illegal or invalid transaction and instead build on the subsequent legitimate/valid block in the chain. As a result, miners must exercise extreme caution when selecting which transactions to include in their blocks because doing so will waste their time and resources on invalid transactions. Miners who include invalid transactions will have a disadvantage in comparison to those who go by the rules, much like in a natural selection process.