Is it possible to COPY tables into PostgreSQL without setting structure first?
If you can live with all columns being text and if the CSV file has at least a header line with column names, then one ugly solution could be:

Create a table with a single column. Then import the first row of the CSV file into that table. You can then get a list of the names and generate a CREATE TABLE statement from that. 

Something like:

create table header_names (header_line text);


Then import the first row into that table. 

Something like (untested!):

\copy header_names from (program 'head -n 1 data.txt')   


\copy and COPY do not have a way of limiting the number of rows that are imported, so you need to use head to just get the first line.

Then use:

select 'create table import ('||string_agg(col_name||' text', ', ')||');'
from header_names
   cross join lateral unnest(string_to_array(header_line,',')) as x(col_name);


The second parameter to the string_to_array() function is the delimiter of your CSV file. 

Assuming you have a header like:

id,first_name,last_name


The above will generate:

create table import (id text, first_name text, last_name text);