with a tiny correction, your understanding is correct.
the line to focus on is line 22 (not line 24). So as long as Line 22 is more than $7500 (before applying the credit), you'll get the whole credit back. Your math is correct.
Unlike the solar credit, the EV credit is 'one and done'. If you can't use it in the year you purchased the vehicle, you can't roll over the remaining credit to a future year.