Many authors have written works which challenge political and ethical norms. These usually won't get you in trouble unless you were to make explicit claims about real people or organisations which are not substantiated, and thus you could be taken to court for libel or defamation.
For example, the Church of Scientology is notorious for suing anyone who publishes anything it doesn't like. Lawerence Wright's 'Going Clear' was banned in the UK due to the unfair nature of English libel laws.
Many books have challenged established values without incurring much wrath. Implementation varies from indirect metaphors in fiction, to fictional characters expressing specific political ideas, to explicit denouncement in non-fiction.
Friedrich Nietzsche published works which couldn't have been more critical about established Christian values. 'Thus Spoke Zarathustra' takes a narrative form, while 'Beyond Good and Evil' is polemic. This didn't get him in much trouble as he wandered about Europe in the late 1800s.
Ayn Rand's philosophy was just as critical, and in interviews she explicitly said her intention was to get rid of America's Christian and nationalist values. Her magnum opus was 'Atlas Shrugged', which is a work of fiction used as a vehicle to transport her ideology.
George Orwell was an influential English writer and socialist, who admitted that everything he had written after his involvement in the Spanish Civil War was against Stalinism and for democratic socialism as he understood it. '1984' and 'Animal Farm' are his most famous works of fiction, while he had also written non-fiction extensively. For example: 'Homage to Catalonia', 'The Road to Wigan Pier', 'On Writing', 'Notes on Nationalism', etc.
While examples like '1984' or 'Atlas Shrugged' are explicit in their depiction of a subject the author wants the reader to appreciate, and 'Animal Farm' is an obvious metaphor for the same purpose, other works simply use the author's intention to underpin the writing. Consider Fyodor Dostoevsky's 'The Idiot', which is an examination of how living life according to Christian principles in contemporary (then Imperial Russian) society causes many problems.
I sincerely doubt your subject matter will be as controversial as you think it is. Vladimir Nabokov's 'Lolita' for example is a very risky topic nowadays, and yet is considered a literary classic.
The only obvious example I can think of to the contrary is Salman Rushdie's 'The Satanic Verses'. His story about a character barely distinguishable from the Islamic prophet Mohammad led to Rushdie having to go into hiding after receiving death threats left right and centre, not least of all from the then supreme leader of Iran.
It's also worth considering that our understanding of controversy is skewed by availability heuristic. That is, we only think of the most obvious cases and don't also consider how many potentially controversial things did not become infamous. Especially considering how hard it is to get noticed as an author anyway!
One case in point is how blasphemous Americans and Europeans somehow manage to bother Muslims in the Middle East, like the Salman Rushdie case. But similar things which happen in unexpected places do not register. Qurans have been burned at protests in South Korea, but nobody seemed to care.
In conclusion, do what you like... unless you somehow manage to write a story which is extremely critical of both the Church of Scientology and Islam simultaneously. Then you may have to go into hiding. That or use a pseudonym. The risk of suffering serious personal consequences for publishing something risky are low. Especially for unknown authors.