On the self-pub side of the publishing equation, you carry your production costs upfront. That's editing, cover art, formatting, ISBNs, copyright and in some cases, printing/distribution. Add audio production (charged per finished hour) if that's a format you offer. None of it is cheap. Yes, big backlists are critical to achieving a profit in this industry, but that's balanced by the upfront costs of production. Emotional costs are a different topic for a different post. Opportunity costs vary by individual but absolutely must be considered. If you're a speedy writer capable of producing 4+ books/year, the cost of production might be what limits how many books you publish in a year. Expect to lose money during your first few years while you build your backlist and your audience.
For my Urban Fantasy series, my cover art is my highest production cost because I didn't want to use stock photo models. I went all-in for the custom photoshoot. Yes, I could cut my art costs significantly by using premade covers or stock photo models. For me, ensuring my model didn't show up on sixteen other books that weren't mine was important enough to allocate a large portion of my budget for cover art.
I chose my cover artist because he's good, he's timely, and he also offers book production services. My "cover art" costs include images and lettering, plus banner/social media images, formatting for ebook and print, and covers for both formats. Essentially, I send my cover artist my completed manuscript and a summary description for what I want the cover to look like and, after a bit of back and forth, he (and his team) send me finished book files that are ready for uploading to distributors. For me, the savings in opportunity costs offset a significant portion of the cash cost. YMMV.
For my High Fantasy series, editing costs me more than art because the books are twice as long as the UF books, and I opted for an illustrator instead of a photographer for the art. Now, let me disabuse you of any notion that illustrators are by default cheaper than photographers. That's not remotely a true or fixed thing. Art is art, thus subject to a very wide price range. There are artists you may love but can't afford (or your schedules may never align). That's a reality that comes with the business. While it's important to have a book with a good looking cover--yes, people absolutely judge your book by its cover, hence the saying--don't blow your budget on art alone. You can always recover your books if/when your budget allows.
If you're writing a series, the production costs are a fairly fixed per-book charge, which makes them easy to budget. Ideally with a series, if you know how long that series is going to be, you can negotiate bundled pricing with your artist and/or book production team. Some will, some won't, some you'll discover you don't want to work with for the whole series (thus, ensure there's an "out" clause in any contract).
Recurring costs like website (hosting, design/build, custom email, SSL, etc.), newsletters, ads-creative, ads-runs, promotions, promotions art/copy, and subscriptions to design/creative creation sites, stock photo sites, cloud storage, distribution sites, and post boxes can be broken into annual charges, monthly, and per-use. These charges may spike when you drop a new release, but they're charges you incur even if you don't publish a new book. They're charges of running the business.
The hardest recurring cost to budget is advertising using CPC, because sometimes the company will use all your daily maximum allotment and sometimes they use a fraction of it. For the purposes of budgeting, assume they'll max you out every day. You don't want to end up in debt due to the whims of algorithms. How much of your total budget should you allocate to advertising? It varies. Less when you're starting off, more at midlist, less once you have a large and dedicated fan base. Not a particularly helpful answer, I know. The most helpful generalization I can offer is that don't spend too much when you don't have a backlist. You need inventory (aka multiple books) for ads to turn a profit because your ROI (return on investment) comes from subsequent full-price sales of your other (non-advertised) books. There are many online classes in advertising. Look for the ones that deal specifically with books and fiction in particular. Book advertising is a different beast from other products. Non-fic relies heavily on author platforms/reputations, which doesn't commonly apply to fiction (you don't need to be an Influencer to write a killer thriller). The book community is hypersensitive to social-space spamming and unsolicited inbox invasions that many product-sales classes encourage, so don't waste your money on broad-topic sessions.
Now, I could go on and on, but this rough overview probably has caused your eyes to glaze over, so I'll stop. The most important thing about writerly finances whether you're trad-pubbed, hybrid, or self-pubbed is that you have a budget and stick to it. Like any creative industry, feast and famine are real. Don't blow your money during seasons of feast; you're going to need it during seasons of famine.