Plone 5.2 - How can I assign ISelectableConstrainTypes/IConstrainTypes behavior to an instance of a container type that doesn't have constraint behavior assigned to its FTI?

I'm working on a behavior that would allow the user to select constrained types in a container, instead of relying on the 'Restrictions menu'.
However, I want to use this with container types whose FTI don't have these ISelectableConstrainTypes listed as a behavior. In order to do this, I think I need to apply IConstrainTypes and ISelectableConstrainTypes behaviors to the instance.
There is a product, collective.instancebehavior, but I don't want to include another behavior to a type.
So I tried following collective.instancebehavior's code and came up with this:

#behavior interface that contains a list of choices of portal types for the user to select, assigned through .xml
class ICustomConstrainedTypes(model.Schema):
    constrained_types = schema.Choice(title=u"Constrained types",
                                                           required=False,
                                                            vocabulary=u"plone.app.vocabularies.PortalTypes",
                                                           )

#event for setting constrained types on on the object for added/modified events
def set_constrained_types(obj, event):
    if obj.constrained_types:

        if not IConstrainTypes.providedBy(obj):
            alsoProvides(obj, IConstrainTypes)
                 

        if not ISelectableConstrainTypes.providedBy(obj):                                                                                                                                                                                                                       
            alsoProvides(obj, ISelectableConstrainTypes)
    
        #Test Constrain Types Mode provided
        if IConstrainTypes.providedBy(obj):
            print(obj.getConstrainTypesMode())

While the condition providedBy returns True, it breaks with saying that getConstrainTypesMode is not an attribute of the object:

Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 266, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
Module plone.z3cform.layout, line 63, in __call__
Module plone.z3cform.layout, line 47, in update
Module plone.dexterity.browser.add, line 138, in update
Module plone.z3cform.fieldsets.extensible, line 65, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 145, in update
Module plone.app.z3cform.csrf, line 22, in execute
Module z3c.form.action, line 98, in execute
Module z3c.form.button, line 315, in __call__
Module z3c.form.button, line 170, in __call__
Module plone.dexterity.browser.add, line 116, in handleAdd
Module z3c.form.form, line 265, in createAndAdd
Module plone.dexterity.browser.add, line 91, in add
Module plone.dexterity.utils, line 178, in addContentToContainer
Module OFS.ObjectManager, line 383, in _setObject
Module zope.event, line 32, in notify
Module zope.component.event, line 27, in dispatch
Module zope.component._api, line 134, in subscribers
Module zope.interface.registry, line 448, in subscribers
Module zope.interface.adapter, line 899, in subscribers
Module zope.component.event, line 36, in objectEventNotify
Module zope.component._api, line 134, in subscribers
Module zope.interface.registry, line 448, in subscribers
Module zope.interface.adapter, line 899, in subscribers
Module my.product.behaviors.constrain_types, line 28, in set_allowed_types
 AttributeError: 'RequestContainer' object has no attribute 'getConstrainTypesMode'

There's another interesting thing that happens when I remove the print statement and just hit save. In the object view, the tool bar menu is replaced with an error message:
error while rendering plone.contentviews
and in the terminal, it shows the error:

2022-04-28 11:23:20,161 ERROR   [plone.app.viewletmanager:114][waitress-1] Error while rendering viewlet-manager=plone.toolbar, viewlet=plone.contentviews
Traceback (most recent call last):
File "/home/username/Plone522/buildout-cache/eggs/plone.app.viewletmanager-3.1.2-py3.8.egg/plone/app/viewletmanager/manager.py", line 110, in render
html.append(viewlet.render())
File "/home/username/Plone522/buildout-cache/eggs/plone.app.layout-3.4.6-py3.8.egg/plone/app/layout/viewlets/common.py", line 79, in render
return self.index()
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/Five/browser/pagetemplatefile.py", line 126, in __call__
return self.__func__(__self__, *args, **kw)
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/Five/browser/pagetemplatefile.py", line 58, in __call__
s = self.pt_render(
File "/home/username/Plone522/buildout-cache/eggs/zope.pagetemplate-4.5.0-py3.8.egg/zope/pagetemplate/pagetemplate.py", line 133, in pt_render
return self._v_program(
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/PageTemplates/engine.py", line 378, in __call__
return template.render(**kwargs)
File "/home/username/Plone522/buildout-cache/eggs/z3c.pt-3.3.0-py3.8.egg/z3c/pt/pagetemplate.py", line 176, in render
return base_renderer(**context)
File "/home/username/Plone522/buildout-cache/eggs/Chameleon-3.9.1-py3.8.egg/chameleon/zpt/template.py", line 302, in render
return super(PageTemplate, self).render(**_kw)
File "/home/username/Plone522/buildout-cache/eggs/Chameleon-3.9.1-py3.8.egg/chameleon/template.py", line 192, in render
self._render(stream, econtext, rcontext)
File "/home/username/Plone522/PloneSiteName/var/cache/72c833376133dc5fc63d900fe9e1c02f.py", line 194, in render
__cache_140238318109840 = _static_140238329679392('provider', 'plone.contentmenu', econtext=econtext)(_static_140238329679200(econtext, __zt_tmp))
File "/home/username/Plone522/buildout-cache/eggs/zope.contentprovider-4.2.1-py3.8.egg/zope/contentprovider/tales.py", line 79, in __call__
return provider.render()
File "/home/username/Plone522/buildout-cache/eggs/plone.app.contentmenu-2.3.4-py3.8.egg/plone/app/contentmenu/view.py", line 18, in render
return self.index()
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/Five/browser/pagetemplatefile.py", line 126, in __call__
return self.__func__(__self__, *args, **kw)
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/Five/browser/pagetemplatefile.py", line 58, in __call__
s = self.pt_render(
File "/home/username/Plone522/buildout-cache/eggs/zope.pagetemplate-4.5.0-py3.8.egg/zope/pagetemplate/pagetemplate.py", line 133, in pt_render
return self._v_program(
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/PageTemplates/engine.py", line 378, in __call__
return template.render(**kwargs)
File "/home/username/Plone522/buildout-cache/eggs/z3c.pt-3.3.0-py3.8.egg/z3c/pt/pagetemplate.py", line 176, in render
return base_renderer(**context)
File "/home/username/Plone522/buildout-cache/eggs/Chameleon-3.9.1-py3.8.egg/chameleon/zpt/template.py", line 302, in render
return super(PageTemplate, self).render(**_kw)
File "/home/username/Plone522/buildout-cache/eggs/Chameleon-3.9.1-py3.8.egg/chameleon/template.py", line 192, in render
self._render(stream, econtext, rcontext)
File "/home/username/Plone522/PloneSiteName/var/cache/565b2103e0c4e59aec70910ca508f321.py", line 122, in render
__value = _static_140238329679392('path', 'view/menu', econtext=econtext)(_static_140238329679200(econtext, __zt_tmp))
File "/home/username/Plone522/buildout-cache/eggs/zope.tales-5.1-py3.8.egg/zope/tales/expressions.py", line 250, in __call__
return self._eval(econtext)
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/PageTemplates/Expressions.py", line 225, in _eval
return render(ob, econtext.vars)
File "/home/username/Plone522/buildout-cache/eggs/Zope-4.6.3-py3.8.egg/Products/PageTemplates/Expressions.py", line 155, in render
ob = ob()
File "/home/username/Plone522/buildout-cache/eggs/plone.app.contentmenu-2.3.4-py3.8.egg/plone/app/contentmenu/view.py", line 27, in menu
items = menu.getMenuItems(self.context, self.request)
File "/home/username/Plone522/buildout-cache/eggs/zope.browsermenu-4.4-py3.8.egg/zope/browsermenu/menu.py", line 52, in getMenuItems
if item.available():
File "/home/username/Plone522/buildout-cache/eggs/plone.app.contentmenu-2.3.4-py3.8.egg/plone/app/contentmenu/menu.py", line 524, in available
itemsToAdd = self._itemsToAdd()
File "/home/username/Plone522/buildout-cache/eggs/plone.memoize-2.1.1-py3.8.egg/plone/memoize/instance.py", line 53, in memogetter
val = func(*args, **kwargs)
File "/home/username/Plone522/buildout-cache/eggs/plone.app.contentmenu-2.3.4-py3.8.egg/plone/app/contentmenu/menu.py", line 542, in _itemsToAdd
return [(context, fti) for fti in self._addableTypesInContext(context)]
File "/home/username/Plone522/buildout-cache/eggs/plone.app.contentmenu-2.3.4-py3.8.egg/plone/app/contentmenu/menu.py", line 545, in _addableTypesInContext
allowed_types = _allowedTypes(self.request, addContext)
File "/home/username/Plone522/buildout-cache/eggs/plone.memoize-2.1.1-py3.8.egg/plone/memoize/request.py", line 46, in memogetter
value = cache[key] = func(*args, **kwargs)
File "/home/username/Plone522/buildout-cache/eggs/plone.app.content-3.8.8-py3.8.egg/plone/app/content/browser/folderfactories.py", line 21, in _allowedTypes
return context.allowedContentTypes()
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/content.py", line 807, in allowedContentTypes
return constrains.allowedContentTypes()
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/content.py", line 807, in allowedContentTypes
return constrains.allowedContentTypes()
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/content.py", line 807, in allowedContentTypes
return constrains.allowedContentTypes()
[Previous line repeated 899 more times]
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/content.py", line 803, in allowedContentTypes
constrains = IConstrainTypes(context, None)
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/content.py", line 168, in __get__
SCHEMA_CACHE.modified(portal_type),
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/schema.py", line 100, in decorator
fti = lookup_fti(portal_type, cache=self.cache_enabled)
File "/home/username/Plone522/buildout-cache/eggs/plone.dexterity-2.10.4-py3.8.egg/plone/dexterity/schema.py", line 63, in lookup_fti
request = getRequest()
File "/home/username/Plone522/buildout-cache/eggs/zope.globalrequest-1.5-py3.8.egg/zope/globalrequest/__init__.py", line 13, in getRequest
return getLocal('request')
File "/home/username/Plone522/buildout-cache/eggs/zope.globalrequest-1.5-py3.8.egg/zope/globalrequest/local.py", line 11, in getLocal
value = getattr(localData, name, marker)
RecursionError: maximum recursion depth exceeded in comparison

What I'm trying to do may seem redundant, but am I possibly on the right track or not at all?

but I don't want to include another behavior to a type.

Why not?

Plone Foundation Code of Conduct