Object-oriented – What are the potential dangers of using this type of cheat in Python thinking?

In a program I'm working on, I have to do a lot of real-time thinking in order to keep a list of known "attributes" throughout the program structure (to be used by some sort of "wizard" virtual programming "). I came up with some kind of "cheater" way of doing this (which I'm quite proud of), which basically looks like this:

old_getattribute = obj .__ getattribute__
def new_getattribute (self, attr):
# different things ...
return old_getattribute (attr)
methods = {"__getattribute__": new_getattribute}
obj .__ class__ = type (# dynamically create a new class
"% s"% obj .__ class __.__ name__, # whose name is _CLASS
(obj .__ class__,), # what CLASS subclasses
methods) and uses the new __getattribute__

Essentially, I dynamically create a new type that subclasses the original type, using a new __getattribute__ method, then reassign internal of the object __class__ to this new dynamic type.

Astonished and happy that it works (in Python> = 3.6 at least), I am always ready to use it. In my old programming in python, any kind of modification of the magic methods of an object from on the outside of the object class the definition was almost forbidden, and yet here I do it twice so really messed up.

I would like as to use it, as this would save me a lot of time instead of keeping an "appropriate" trace of individual objects, then to constantly check for changes, but I want to be sure not create potential danger for the rest of the program.

That's why I'm here to ask questions. From the point of view of software architecture, how potentially dangerous is this method and what are the pitfalls that I might encounter to make it work? I'm sure there are more than a few general principles of OOP / programming programming that I am severely violating with this, but I'm willing to let them slide if it can be "managed."