Be sure to have FOR UPDATE on the end of the SELECTs. Else another connection could sneak in and change the results of the SELECTs.
Also, steps 1,2,3 need to be inside a single TRANSACTION.
Once you do all that, you can probably leave the isolation level at the default.
You don't need to query the table, to get the generated id, you can get that using the lastval() function:
insert into company_profile (....)
insert into related_table(company_id, ...)
values (lastval(), ...);