How to make a variable available for the duration of the page request

A class provides structure, and if it’s what you need to do it then do it. The alternative would be a global variable, which is bad practice and should be avoided ( and makes reliable unit testing near impossible )

However, your entire premise is unnecessary. WordPress already stores the option in its caches, so no second database call occurs.

Otherwise yes, a class or object would be the answer

tech