What is happening under the hood in MySQL 8 when I apply an auto-increment primary key to a raw table of data?
Do you care whether you keep the old auto_increment values?  Your process seems to loose them.
Did you have innodb_file_per_table turned on when the original table was created?  If yes, there are easier ways; if no, you need to dump all tables and rebuild.
Be sure to have innodb_file_per_table=ON
What percentage of the table is to be kept?  If it is a small percentage, don't bother with the CSV steps, simply rebuild the new table as InnoDB.  Also you won't need to rebuild the AI.
While you are at it, consider shrinking the datatypes.  INT takes 4 bytes and BIGINT takes 8.  Look into smaller datatypes.  And UNSIGNED.  (Eg, SMALLINT UNSIGNED takes 2 bytes had has a range of 0..64K.)
Adding and dropping secondary indexes (but not the PK) is efficient in 8.0.
Do you have any other indexes, perhaps even composite indexes?  Is any of them 'unique'?  If so, could you get rid of id and use that index as the PRIMARY KEY?
Can each of the columns really be NULL?  Consider fixing that if necessary.
Do the rename in these steps.  This minimizes downtime:
RENAME TABLE real TO old,
             temp TO real;
DROP TABLE old;

More tips on big deletes and related things:  http://mysql.rjweb.org/doc.php/deletebig