copy a sqlite3 table preserving custom _id
Just copy the ID values over:

CREATE TABLE messages (_id INTEGER PRIMARY KEY AUTOINCREMENT, key_remote_jid TEXT NOT NULL);
ATTACH 'msgstoreF.db' AS android;
INSERT INTO messages (_id, key_remote_jid)
    SELECT _id, key_remote_jid
    FROM android.messages;


Please read the SQLite Autoincrement documentation. New ID values will not conflict with the manually inserted values. (And it is likely that you do not need to specifiy the AUTOINCREMENT keyword.)