Is it ATC's responsibility to ensure read backs are correct? I have experienced this a few times in the last couple of months. When the ATC assigns me a squawk code and I enter it in the transponder, a few minutes later when I try to reconfirm the squawk code, they give me a new code. I know that they can see me on the radar anyway, just may not identify me positively. I noticed this more on an inbound flight to a towered airport.

This happened yesterday too. I was assigned to squawk 6451. I replied to confirm it and entered it in the transponder. While holding short for takeoff, when I asked the controller to reconfirm the code, he said that it is 6455.

What is the controller's responsibility if they confirm an incorrect read back? Since this happened to me several times, I am concerned if such incident can impact safety, traffic advisories or aircraft separation?
A controller, should be on the lookout for all incorrect readbacks. But controllers are human, and can easily miss them, or say things in correctly. Incorrect squawk codes are often more of an annoyance versus an actual separation issue. It'd become an issue if they didn't take action when it was noticed that there was an incorrect code airborne, and let you truck on your way and not perform appropriate handoffs or inform others of any issues with your flightplan/target.

Most of the time, an incorrect beacon code will be flashing on the scope, if it's not assigned to someone else, and the controller will look through their list to find the correct code. If you tag up under someone else's code, then it becomes more of an issue, as they have to realize it's incorrect, suspend the datablock, and flightplan(or most likely drop it out of the system and reenter it) (flightplan issue is often delegated to others in the operation), and hunt for your correct code.