I would use Interfaces between AnimBP and PawnBP, The PawnBP implements an Interface “FootstepInterface” with your logic you posted above. The AnimBP calls this Interface via Messages with the Notifies on the Pawn Owner.
This way the AnimBP doesn’t care about the concrete type of your pawn, only that it implements this interface.
€dit: You can however just use the AnimBP completely, all you have to do is to replace “GetPlayerCharacter” with “Try Get Pawn Owner”.