You probably need to run vacuum analyze after filling in the data.
Otherwise it's using bogus selectivity (see the number of expected
rows returned by the explain output, it's expecting 6000 rows after
the create index, which is large enough to make it guess that
it'll be cheaper to sequence scan the table.