It’s not simple accounting…lol. A cost basis cannot be negative. What you are referring to is a return of capital while reinvesting a piece into the same security. Every share you had and every share you own had/has a positive cost basis.
I get what you are trying to say by taking the concept of dollar cost averaging allowing it to go negative by labeling the return capital as a “negative cost” which is pretty tortured.…but it is certainly not any form of “accounting”.