First, I removed hardcoded pks where they aren't needed (PR 21364).
Trying to rework the tests that require hardcoded pks may be possible in some cases, however, I believe some form of get_hardcoded_pk() API will be needed, so I feel the most expedient path forward is to merge the patch and leave test refactoring to a later task.
Incidentally, I didn't update serializers and fixtures tests to use get_hardcoded_pk() since it's a bit trickier, but this would also be a useful follow up task. There's a commit on the Django fork used to run the test suite on MongoDB that updates all fixtures to use ObjectIds instead of integers (e.g. "pk": 1, because "pk": "000000000000000000000001",) and this would remain, but the hardcoded pks in files such as tests/fixtures_regress/tests.py could be replaced.
At your request, I created forum topic Adding database backend methods to get hardcoded or nonexistent primary key values for tests to solicit feedback.