Impossible to get area_id and device_id from yaml code

Most of entities have device and area binding, but there is no way to get device_id or area_id from yaml code. It makes impossible the use of logical entities grouping with help of device_id and area_id value, what is important, for example, for a number of devices placed in the same room or for a number of entities of one platform such as esphome devices. In such case you could set the same area_id with the name “my_esphome_devices”, for example, to those entities via GUI and then collect all or some of those entities by my_esphome_devices area_id attribute.
It is even weirder considering that there are some ways to use device_id and area_id in automations via platform or target options:

Please, add device_id and area_id standard attributes to the entities.