Seems it is already on cars, at least my 2020 RX has whats called "Intelligent Clearance Sonar System" and the example given to describe it is where the driver selects D instead of R to reverse out of a parking space and accelerates, the system detects the wall in front and reduces torque and applies the brakes. Similarly when pulling into a space the driver hit the accelerator instead of the brake the system takes over, disabling the throttle and applies the brakes.