The limit SQL backend builds a couple of SQLAlchemy queries inside
session_for_read contexts but evaluates them after the context has exited.
Keep those query executions inside the read session so the database access
happens within the intended transaction scope.
Use a single-row existence check when looking for referenced limits instead
of materializing every matching limit row.
Generated-By: pi gpt-5.5
Related-Bug: #2152932
Change-Id: I3808d57ffab52f768420f26c3346a898bf73643a
Signed-off-by: Sean Mooney <work@seanmooney.info>