Add partition pruning to pipeline lookup queries
## Summary
The following query runs a few hundred times per second distributed across nodes, and lacks a `partition_id` filter, causing full cross-partition scans on `p_ci_pipelines`:
```sql
SELECT "p_ci_pipelines".* FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."id" = $1
LIMIT $2
```
- **Dashboard**: https://dashboards.gitlab.net/goto/efgz12snw1fcwf?orgId=1
- **Fingerprint**: `c29690408ab28010`
- **Query ID**: `-6756117007090651256`
A likely point of entry is `merge_request.head_pipeline`, which looks up a pipeline by ID without scoping to a specific partition.
## Proposed Solution
Investigate where this query originates (likely through `merge_request.head_pipeline` or similar associations) and add `partition_id` pruning so the query is scoped to the correct partition rather than scanning all partitions.
## Impact
- As the number of CI partitions grows, each unpruned scan becomes progressively more expensive
- Running at a few hundred RPS across nodes means this has significant cumulative cost on both primary and replica nodes
## Parent
Part of [#594500 - Immediate partition pruning for high-impact queries](https://gitlab.com/gitlab-org/gitlab/-/work_items/594500)
task