Not OP but I would and do write things 20x, for the simple reason that the 2nd is better than the 1st, even after refactoring the first, the 3rd better than the 2nd etc. We have a durable workflow thing from when it wasn't a thing yet (it was called enterprise workflow engine or something back then) which I started in PHP in the mid 90s, it has been rewritten by me over 30x and now its as optimal as it can be. It is finally finished. I have 20 year old clients who upgraded to it and are happier with the performance and stability. We do this with many parts of our software stack; not big refactoring but rewrite from scratch. One thing with this: in my opinion you can only rewrite if you are NOT adding any features; it should be a 1 to 1 rebuild.
30 times. And stable for 20 years. You are the proof that "Slow is Smooth, Smooth is Fast." I am just a loan officer observing the craft; you are the true Master Carpenter. Respect.