This is not completely correct. The [L] flag only stops rewrite processing, but doesn't stop processing at all like [END] flag depending on httpd.conf. Only rewrite rules are affected, but you are right to place cache rules at the very top of .htaccess.
Penetration test for your "code"
What happens if these UAs visit your page? ;) They are very popular all over the world and they are all crawler like.
okhttp/2.5.0
Safari/14609.1.20.111.8 CFNetwork/978.2 Darwin/18.7.0 (x86_64)
Dalvik/2.1.0 (Linux; U; Android 10; ART-L29 Build/HUAWEIART-L29)...
Again, if page is cached PHP can't be executed and you need to solve it with .htaccess Rewrite Rules. .htaccess has no logic to detect if client accept ccokies or not, so you can only check with with .htaccess if a specific cookie exist or not. If not -> no-cache. Otherwise such clients like...
For Virtualmin is no plugin available, so you must do a Generic LSWS Web Server Installation, but be carefull. It is not tested:
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:installation:generic
Of Course there is a way, but any other way brings new issues. The consequence of this dilemma could be to disable cache for any users that doesn't accept cookies.
RewriteCond %{HTTP_COOKIE} !name_of_vary_cookie [NC]
RewriteRule .* - [E=Cache-Control:no-cache]
Not lscache uses cookies, your plugin uses vary cookie. Using cookie to store information which device is used is a absolute wrong method. To me, bad idea to use cookie for this. Ask LiteSpeed staff if they re-design this plugin.