'EarlyStopping' object has no attribute 'on_train_batch_begin'
From the stack trace, I notice that you're using tensorflow.keras but EarlyStopping from keras (based on the the other answer you referenced). This is the cause of the error.
This should work(import from tensorflow keras):
from tensorflow.keras.callbacks import EarlyStopping
If you want to use all of Keras's functionality you can't use Tensorflow 2.0. Keras integration is incomplete.
pip install --upgrade "tensorflow==1.4" "keras>=2.0"