Wiring up a switch for recessed lights using only 1 ROMEX pair
Not any more. You are describing a two-wire switch loop that used to be allowed, but now is not.

First your diagram shows black and red wires. One of them should be white (neutral), the other black or red (hot).

Current code requires that switch boxes have a neutral wire, not just a hot and a switched hot. This is required, even if your switch doesn't currently need a neutral. The next device you put in that box might.

Standard practice now is to use 3-wire (black/red/white + ground) cable to the switch. Black and red are the active lines, and the white is capped off if not needed.