When you get cancer you encounter cells that through natural selection developed to beat your immune system so they've already essentially discovered every trick in the book and when you attack them the cells that survive are those who wrote a new book to do so.
Things like tumor escape mechanisms aren't sentient they are just random things that cancer cells attempt and you only see the outcome of those that worked.