Some agents and publishers are still snooty about self-publishing, but many use a writer's sales and online author platform as a quick way of assessing their commercial appeal. They do the same thing with shortlisted authors in writing competitions. It beats wading through the slush pile.
You could adopt a damned if you do, damned if you don't attitude towards whether to self-publish while querying literary agents, but, I prefer to look at it as blessed if you do, blessed if you don't. It's all good. With writing, you're in control for much of the process, meaning you have to generate self-belief. The worst thing to do, and many writers do it, is to fall into the trap of waiting around for the opinion of a literary agent about their manuscript. That wait could be short, just a few days, but months often drag by; my record wait was two years for a two-person agency to reply with a rejection.
Do things in the meantime. Write the next story, write outside of your comfort zone, maybe tackling poetry. Keep yourself interested in being a writer, when it feels like those of influence don't give a damn that you exist. They don't, unless they think they can make money from your words.
One thing that will help your career, whether you self-publish or secure a publishing contract, is to build an author platform. Most writers are averse to this notion—I was, hoping I'd get an agent—six years and 650 rejections later, I finally pulled my finger out and started blogging and designed a website dedicated to my crime novel series and made social media posts. This all feels very abstract, a million miles away from writing, but you have no way of knowing what will catch someone's eye. These days, it's crucial to interact with readers. That's true if you're an Indie self-publisher or in thrall to a book publisher. The feedback is helpful and shares of posts you make spreads your influence.
I'm not pretending things are easy. Self-publishing a book is as easy as making a few mouse clicks, but selling it is another thing, requiring much self-promotion and marketing—which will wear you down. It's the main reason that writers chase a publishing deal, hoping that their book company will make them into a best-selling superstar. The way that advertising budgets are these days, debut authors are expected to hype themselves. My attitude is, if I'm going to be coerced into shooting my mouth off by my publisher for a minimal cut of the profits from sales in two years, then I may as well do so for myself for all of the profit right now!