While not as versatile as Target Display Mode, you can use AirPlay over a wired connection from Mac to Mac: https://www.macrumors.com/2021/06/09/airplay-mac-to-mac-exte...
Weird it's still called AirPlay, but at least it's possible. The video will be compressed, though unlike Target Display Mode