When thinking about if you can do some move, you look if your king will be attacked. This would lead to a recursion, but actually dont, since you it doenst matter if this enemy piece would be able to check/mate your king or if it would not be allowed to do the move because of check and mate rules.
The question is, its possible to on my turn put the enemy king into mate if this will put my king into check