This will render your solution useless. What is supposed to be perfect about it?
But the cache plugin uses cookie for detection and if you have custom cache varies defined in .htacces these varies will conflict with defined ENV:LSCACHE_VARY_VALUE of the cache plugin. The result of this conflict is that URLs will not be cached.
Also, _lscache_vary cookie isn't set at first page load, because the set of this cookie depends cookies set by OC. That means there is no detection at first load. This is a big fail of the cache plugin and you extend this fail with your custom extension.