Anyone looking at the rise of AfD should also look at the example of Denmark, which some years earlier had also seen a strong rise of radical alt-right parties, but once the centrists switched their stance against immigration, at the next elections the radicals went back down to their rightful 1% or so of votes. That is also an example which shows that indeed it is possible to compete with hate-based politics with actual actionable and long-term viable policies.
Indeed, SPD should instead examine why they themselves are losing votes and consider it their duty to provide some alternative for German voters so that a person can vote against immigration without getting the full neo-nazi package in addition to that.