Well I can explain the formula for you:
cos(angle) gives the x-portion of the bullet movement back to you (going right on screen gives a positive value, going left a negative value)
sin(angle) gives the y-portion of the bullet movement back to you (going up = negative, going down = positive)
dt*bullet.speed just is the distance the bullet would travel without interference
so all it does is setting the movement on the overlapped axis back to where it was before the bullet movement of the current tick while retaining the bullet movement of the other axis.
Result: bullet speed is not retained, if you want that you probably need to add the movement you've taken away to the other axis (need a condition construction to not get the signs (+-) wrong)
Result 2: once both overlap, you get no movement at all (in your version) or weird movement (when keeping bullet speed constant); can't really prevent that no matter how the dimensions of the boxes are; only thing you could do is check if movement is frozen and then do a turnaround or slight change in coordinates to allow a fresh approach to the wall (this is probably prefered for you)
so I can imagine that something like this could work:
Detector X overlapping wall
--> Enemy set X to self.x-cos(self.Bullet.AngleOfMotion)*self.Bullet.Speed*dt
--> enemy add "1" to enemy.variable
Detector Y overlapping wall
--> Enemy set Y to self.Y-sin(self.Bullet.AngleOfMotion)*self.Bullet.Speed*dt
--> enemy add "1" to enemy.variable
for each enemy
-system compare
--> if enemy.variable greater of equal 2: enemy set y to self.y -sin(self.bullet.angleofmotion)*self.bullet.speed*dt
--> set enemy.variable = 0
instead of modifying the angle you can also add -sin(self.Bullet.AngleOfMotion) to y to make the enemy take a new approach