Repair and maintenance costs can be either operational expenses or capital expenses: https://www.nashadvisory.com.au/resource-centre/repairs-and-...
For example, if you pay for someone to maintain the brewery plant to keep it working in its current condition, that’s an operational expense that could immediately be deducted. But if the work is on upgrades and improvements, that’s ordinarily would be a capital expense that must be capitalized and depreciated. A bookkeeping strategy isn’t.
Your other examples are off the mark, because the question is whether the investment produces an income-producing asset. Software generally is such an asset. The question of what’s an operational expense versus what’s a capital expense isn’t always clear cut, and is the kind of thing where accountants and tax lawyers have to make judgment calls.
Both cases are tax-deductible, what matters is not whether it's operational or capital, because for example building up inventory would make an operational expense a capital expense, but whether you then sell or rent/lease/use yourself/... what's maintained or repaired (then it's COGS) or you use it yourself (then it needs to be amortized)
The tax code has been optimized by the rich over the past century to extract profits out of industrial firms and that's where the difference comes from. $100 used to, say, produce a car or a cake that you then sell is immediately and fully deductible from tax because otherwise industrial companies just outright can't survive. Hell, you get to claim back/not pay any VAT and/or sales tax you paid for anything related to them. One way to see it is that these rules are designed to get money to the (existing, "old-money") rich, so when investors don't get money, the government doesn't get money.
If it's equipment for the company to use itself, then it has to be amortized, or more to the point, it means industrial companies can't do what Amazon did: use 100% of their free tax flow to grow "tax-free*" instead having to give that money to the government and investors (15-35% to government 65-85% to the rich, sorry, investors), so they can use it for their own ends.
I'm not judging one to be good or bad, just attempting to frame this correctly. I should perhaps point out, as a last point, that this is a massive difference between the US and European countries. In Europe, investors and governments try to have their cake and eat it too: there's tax due (amortization rules, or worse) on new company creation, on company growth, except of course, for the companies of the rich: you can grow financial capital in companies without paying a cent, money, shares, obligations, ..., just nothing else. That's yet another connection to the rich, to investors. New employees, new buildings, ... are double taxed, only money isn't. In Europe, there have only ever been exceptional cases where it was otherwise. In the US "tax-free" new company creation has been the norm for all of history except since Trump changed this rule.
* between quotes because they still have to pay income tax on any wages, sales tax on any purchases, ... it is very far from tax-free, but such companies wouldn't pay a dime to investors. If they did that would make it very hard to create new companies (which is what this regulation does). Amazon's great accomplishment is not AWS or anything like that but 2 financial accomplishments: first, avoid sales tax, second, avoid paying anything to investors. Whatever business Amazon is in is nothing but a tool for that financial engineering.