I wanted to write a comment - but it just becomes too long, so I'll use an answer instead.
I think there are an awful lot of cultural ifs and buts in this, so adding your location would help. I can look at it from a UK/EU angle and this might be quite different for other regions on this planet.
When I was in the UK, we had people come "back" to university at a later date for their PhD. One guy worked at a company doing programming/numerical modelling, another was in some way involved with railways I think.
This was in an engineering department at the university.
The term would be "mature student", which exists also for undergraduate and postgraduate degrees and is not particularly uncommon in the UK.
In fact, the classical route for many people in the UK is BSc (first or 2.1) and then a PhD IF they carry on to obtain a PhD.
The Masters is something people either get later in life or people from outside the UK obtain within the UK before continuing with a PhD.
Part of the reason being, that you'd have to self-fund a masters in the UK...
(Incidentally, a UK Masters is 1 year, while in the rest of the EU it is 2 ...)
On the other hand, I think it is rarer for people in the rest of the European Union to return to academia later and the Masters before a PhD/Doctorat is pretty much standard. There are people who return to academia post retirement as they find they now have the money and time to pursue their interests and some people do return to academia later, to, in a way, "make up for previous mistakes" (e.g. not caring enough about school, etc.).
So it does happen, though I don't think normally at the PhD level.
If you are in the UK or a country where it is not uncommon to return to academia later, it may be an idea to go into a "research & development" group at a company after your Masters degree. While the work there is very different from academic work and generally more applied, it will give you an idea whether you enjoy "this kind" of work.
If you do, you can consider returning to academia - maybe even with the support of you employer - and possibly work on an industry funded PhD which is generally more applied than the research council funded fundamental work.
Some countries/universities also allow "staple theses" (the UK does not I think), which basically require you to only add an introduction and effectively bind a number of papers together. (Whether this is good or bad is a different discussion...)
Implementing and improving algorithms is are "tasks" that can definitely be appreciated in research.
If you are good at doing this, then I'm sure groups that work on algorithms will appreciate the work - as will companies with in house code development.
Short of trying, you will never know whether you can obtain and whether you enjoy obtaining a PhD.
The type of supervisor will incidentally be also very important in this respect.
And be warned that your area of expertise may very well change during the PhD (at least in the UK). The guy who was programming? He ended up doing some experimental combustion work... - And I somehow arrived in chemistry and programming despite coming from (applied) mathematics...