It's not that clearcut. Did you know Thiel is a libertarian and hates the police state?
So why is he working with the government then? Well, a combination of something he wants to change and business opportunity. Sometimes to change something, it's best to work within the system and help steer it another way. The government has been invading people's privacy for a long time and increasingly so, with or without Palantir. At least this way he has influence over the direction. But who knows in reality how much is driven by trying to improve it vs making money and how that calculus works out.