Not sure I understand your scenario, if id is primary key in tableA there can never be more than one id of each id. Assuming the following:

    insert into tableA (id, user_id) values (1,1);
    insert into tableB (id, user_id) values (1,2);

If you delete from tableA and want referential integrity you by necessity have to cascade the row from tableB, or prevent the delete. 

If on the other hand (id, user_id) is primary key (or a unique constraint) in tableA you can create a foreign key against that:

    ALTER TABLE TABLEA ADD CONSTRAINT AK1_TABLEA UNIQUE (user_id, id);
    ALTER TABLE TABLEB ADD CONSTRAINT FK1_TABLEB 
        FOREIGN KEY (user_id, id)
            REFERENCES TABLEA (user_id, id)
                ON DELETE CASCADE
                ON UPDATE CASCADE;

Now the insert I did above is illegal since there is no (1,2) in tableA. However:

    insert into tableA (id, user_id) values (1,1);
    insert into tableA (id, user_id) values (1,2);
    insert into tableB (id, user_id) values (1,1);
    insert into tableB (id, user_id) values (1,2);

is valid, and if you delete:

    delete from tableA where id = 1 and user_id = 2

the corresponding row in tableB will be cascade deleted. Example:

    MariaDB [test]> create table ta (id int not null, user_id int not null
                 ,    constraint pk_ta unique (id, user_id)) engine=innodb;
    Query OK, 0 rows affected (0.01 sec)

    MariaDB [test]> create table tb (id int not null, user_id int not null
                 ,    constraint fk1_tb foreign key (id, user_id) 
                      references ta (id, user_id) 
                         on delete cascade on update cascade) engine=innodb;
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [test]> insert into ta (id, user_id) values (1,1),(1,2);
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0

    MariaDB [test]> insert into tb (id, user_id) values (1,1),(1,2);
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0

    MariaDB [test]> select * from tb;
    +----+---------+
    | id | user_id |
    +----+---------+
    |  1 |       1 |
    |  1 |       2 |
    +----+---------+
    2 rows in set (0.00 sec)

    MariaDB [test]> delete from ta where id = 1 and user_id = 2;
    Query OK, 1 row affected (0.01 sec)

    MariaDB [test]> select * from tb;
    +----+---------+
    | id | user_id |
    +----+---------+
    |  1 |       1 |
    +----+---------+
    1 row in set (0.00 sec)