key value being replaced by 'key' when using merge() in twig
You need to wrap your variable with parenthesis to be able to use it as a key.
{% set params = params | merge({ (key) : value}) %}
With numeric keys you can lose your key in the process, with the m̀erge`filter.
I couldn't find any documentation about the '+' operator applied with arrays, but it works well in this case:
{% set array = {(1): 2} + array %}
Source: https://github.com/twigphp/Twig/issues/2741#issuecomment-417445042