This has been instrumented with a warning for a number of years and is generally considered an anti-pattern.
The good news is that this isn't actually a pattern we've had to move away from, it was just never really a thing in recent history.
Despite that, we have seen in two cases in recent years that changes to code accidentally resulted in this indirectly happening and we missed it for a while because it isn't enforced.
- 2018: T191116: Wikimedia\Rdbms\Database::tableName: use of subqueries is not supported this way.
- 2022:
This was caused by:
SpecialRecentChangesLinked: Pass query builder instead of SQL
And fixed in:
Proposal
Turn the warning into an exception. As suggested by @aaron: