Publishing is a business which produces books in order to sell them. It depends on writers, agents, editors, designers, illustrators, copy-editors and printers to produce those books; and on marketing staff, publicists, sales agents, wholesalers, distributors, bookshops and booksellers to sell those books.
All of the people who are involved in the production and sales of books depend on one thing to fund the work that they do: the reader. And because readers fund publishing, they drive the whole of the publishing process. When readers don't buy books, the publishers lose money and everyone involved in that supply-chain suffers.
So when publishers recognise that a particular type of book doesn't sell well they stop publishing it, or they stop publishing so much of it and get really picky about the books in that genre which they will consider.
Conversely, when publishers notice that a particular type of book is selling very well, they will look for others of that type to publish.
If publishers won't consider a particular genre, agents won't be able to sell it to them; so agents quickly learn what publishers will and will not consider. As those agents don't eat if they don't make sales, they don't take on books they don't think they can sell no matter how much literary merits those books might have.
So please: don't suggest that literary agents are unfairly stifling new writers because of their own personal agendas, or that publishing is ignoring whole swathes of talented writers because those writers write stuff that is somehow too contentious or unpopular to make it onto their lists: agents, editors and publishers all look to the reader when deciding what to take on, and if readers aren't prepared to buy a particular type of book, then that type of book is very unlikely to get published.
It comes down to this: to stand a chance of being published, your book has to be well-written, but that’s not enough on its own. If readers are likely to buy your book and it is well-written, then it has a good chance of getting published; but if publishers know from their years of experience that a book like yours is unlikely to attract enough readers to make it commercially viable then it is not going to get published no matter how well-written it is.