Currently, there is no special case for decorrelating a subquery that filters with an equality on something from the outer query.
This results in a table join that can be optimized away. While it is technically possible for the database to optimize this join away if foreign key constraints are assumed to hold, this is not done by SQLite.