Execute some steps before REST POST request
There is a hook called entity_presave.

This is always called when you persist a new or updated entity through Drupal API. 
You can always check for the current request's method to see if it was a POST method (you can also check for the route itself). 
So these presave changes (or can be save or post save) will be only taken place if that criteria is met.