I have a 2021 BMW and a 2022 Hyundai - both electric. Neither of them work in this way.
The BMW will try to auto lock and it works much of the time, but if you open the boot and then close the boot and walk away it will frequently not lock the doors. There is no feature for 'after X minutes auto lock'.
The Hyundai can be set to auto unlock as you approach but has no feature to auto lock as you leave.
We previously had a 2024 Nissan. This also did not lock as you walked away.
I would pay money for a feature that does as you say, but I have 3 example of what I would consider to be modern cars that don't work like that.