To use this fix is quite easy, add the class into one of your libraries and add the following patch
The code does exactly the same thing as the sitecore.kernel the only difference is the args.PermissionDenied = flag; which was present on SC 8.2 and got removed on SC 9.0 (initial release)
ps. don't forget to install the nuget Microsoft.Extensions.DependencyInjection.Abstractions.