This hits the mark.
I don't think developers should even necessarily explain that this is what they are doing, because then they have to ask permission to do it.
I'm constantly thanking "myself from the past" when I go to implement some new feature and find that the surrounding code is clean and well organised and ready for that new feature to be easily implemented.
In my experience, it pays to be open with product managers and QA about what you are working on, how you are implementing it, what the risks and benefits are, etc. For example, it helps QA to focus their testing efforts on the areas that are most likely to be broken by a refactor. And having some understanding of how an app is built and where the problem points in the code lie helps product managers to develop a sense of how much effort a certain change might take, and reduces the chance that they will be surprised by some behavior in the app as the result of a change.
And if someone on the team wants to question me about the cost/benefits of a certain refactor and discuss alternatives, I think that is totally fair game. Same way that if I want to ask a question about the cost/benefits of a new feature and discuss alternatives, I feel empowered to do so. It's not about asking permission so much as it is about developing a shared understanding of the costs and benefits of the decisions that we make, and working together to optimize them.
On the other hand I remember on some projects there being real (HUGE) pushback from the client about doing anything that wasn't implementing features exactly as they define and "are paying for".
As soon as you declare that you are doing something "optional", it gets political, people start talking about it, it escalates to project manager, their bosses boss etc and the shitfight starts. Ugh.
The reason they're paying so much for it is that you didn't do the refactoring last time. Every time they refuse a refactor, all their future costs genuinely go up.
If they ask why the refactor is needed, why you didn't do it properly first time round: “You're constantly refining your business processes to satisfy ever-changing business needs; that's what I need to do to the code.”
The more experience you have with the reverse of that situation ("Dammit past koolba, what the hell were you thinking?!"), the more you value dedicating time to both doing things right and going back to progressively clean them up.
The real skill to learn is to properly isolate quick and dirty solutions so that they can be easily replaced down the road. The sausage factory does not need to be spotless on day one, just the entrance and exit doors.
It's rare to fire new employees in their first few months, but it does happen. Similarly I have seen people join a company, and leave after their first week because a better job offer came in. It sucks when it happens... but overall I'd say the system works pretty well.
Yeah, in an at-will state you might as well consider the "trial" period to be in place no matter what. If things don't work out well they'll just toss your ass to the curb. Maybe if you're lucky like me your boss will have a soul and give you some amount of severance at least.
Two people were hired. Me and another dude.
The other dude was invited to look elsewhere (they let him stay and work while he looked for a job so that was very nice), and I got a series of raises after they clearly were comfortable with me. They then started looking for a replacement for the other dude.
Effectively I assumed (correctly) I was on a sort of "trial" anyway.
I like to do minor refactoring as part of any given new feature (even if unrelated). It helps take bites out of the larger pieces over time.
"Tolerating a bad employee versus firing and rehiring"
Inversely this also gets into something I often see where companies sit and wait for the best possible candidate (everyone claims to hire the best...) and so rather than hire and try people out they take a long time and hire someone and hiring being a non exact science.... doesn't work out. Maybe people need to try folks out, even maybe the person who doesn't have every bit of alphabet soup on their resume?