Then Trump should have confronted the black ministers directly about being influenced by BLM or making their attendance contingent on a later endorsement. If he can’t tell it as he sees it face to face he shouldn’t be making insinuations in the press that throw potential supporters under the bus.
I don’t know all the facts as to what he said to the pastors ahead of time and when he said it, but your assumption that his actions are a case of throwing these potential supporters under the bus is just that, an assumption. Perhaps his actions were a result of not thinking things out ahead of time. The other possibility is the he handled things exactly the way he wanted to to try to achieve the best outcome.
Looking at this as a deal in the making, as I’m sure Trump did, his actions were probably based on calculation. Trump has an uncanny knack for sizing up the dynamics of such situations so my guess is that the outcome of this situation is not as bad as you assume. Perhaps his comments actually help many of the pastors communicate something that they would like to communicate but which they are uncomfortable communicating. It’s very possible that Trump’s statement got them off the hook.