As far as I know, the term for a sacrifice that causes a player to block an escape square called a “selfblock,” altough it is a type of selfblock.
For a composed example, here is one that shows the idea. White sacrifices a pawn on d4 and a rook on e4 and this causes Black to move their pieces to those squares, thus taking away escape squares from the Black king.
[Title "Julio César Infantozzi, Mate In 16 Moves"]
[FEN "R1n2N2/4pk1B/2Q1r2B/2K2b2/Rr1n2P1/1q1P1PP1/4N2b/8 w - - 0 1"]
1. Qe8+ Kxe8 2. Rxc8+ Kf7 3. Bg8+ Kxg8 4. Ng6+ Kh7 5. Rh8+ Kxg6 6. Nf4+ Kf6 7. Rf8+ Ke5 8. Bg7+ Rf6 9. Bxf6+ exf6 10. Re8+ Ne6+ 11. Rxe6+ Qxe6 12. Ng6+ Bxg6 13. f4+ Rxf4 14. gxf4+ Bxf4 15. Re4+ Bxe4 16. d4
You can find more such chess problems here, and there is even a ChessBase article on the subject.
I found a game where this actually occurs, pulled from this chessgames collection.
[Title "Tigran Levonovich Petrosian-Ara Minasian, 66th Armenian Championship, Yerevan Armenia, 3/19/2006"]
[FEN ""]
[startply "56"]
1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. O-O Nxe4 5. Qe2 Ng5 6. Nxg5 Qxg5 7. d4 Qe7 8. dxe5 Nd4 9. Qd3 Qxe5 10. Bd2 Ne6 11. Re1 Qd6 12. Qh3 Be7 13. Bd3 c6 14. Nc3 Qc7 15. f4 g6 16. g4 O-O 17. f5 Ng5 18. Qe3 Bf6 19. Rf1 d5 20. fxg6 d4 21. gxh7+ Kg7 22. Qe1 dxc3 23. Bxc3 Qb6+ 24. Kh1 Bd4 25. Qh4 Ne6 26. Qf6+ Bxf6 27. Bxf6+ Kh6 28. Rf5 Ng7 29. Rh5+ Nxh5 30. g5#
White “sacrifices” their rook to h5 with a check, which in turn causes Black to move their knight there, depriving the king of an escape square, aka a selfblock.