Is it unethical to use a published code in my PhD thesis work?
There are three issues:

Is it a copyright violation? This depends on the license under which the original code was released.  You'll have to read it.

Is it plagiarism?  No, you have credited the original author.  However, you may want to make it more clear that it is really a relatively minor modification of their code.  Your current wording, &quot;developed based on work...&quot;, could be interpreted as &quot;I got some ideas from their work but then wrote all my code from scratch&quot;, which would misrepresent the real contribution of the other authors.

Is it adequate for your PhD thesis? You could write an entire thesis that just used the work of others, appropriately cited, with minor tweaks.  It wouldn't be plagiarism, but it also wouldn't get you a PhD, because it doesn't demonstrate an ability to do independent research.  So, you need to make sure that your advisor and committee are fully aware of what parts are your own work, and what parts are the work of others, so that they can evaluate your research accomplishment based on what you did.  If they don't feel it's adequate, then you may have to do more work in order to complete a thesis that will pass.
The same applies when you publish a paper.  Here, the editors and reviewers need to evaluate your paper based on its novelty - what part of it is new work, versus what simply makes use of existing work?