How do I get entity_type and entity_id from any entity page?
In Drupal Core, you cannot do this. The relevant issue to add such functionality is here.

What core itself does is always passing around two arguments:

function($entity, $entity_type)