It seems there is a consensus confirming my statement about not using the SystemVerilog program block. (You should be careful about your textbook).
That's what AI answers to "is it a good idea to use the program block in systemverilog ?" :
In modern SystemVerilog verification, the short answer is no, it is generally no longer considered a good idea to use the program block. While it was introduced early on to solve a major problem, evolution in verification methodologies—specifically the widespread adoption of the Universal Verification Methodology (UVM) and the strategic use of Clocking Blocks—has made the program block largely redundant and, in many cases, a source of subtle bugs.