Check the condition of the Battery. If the Battery condition shows as anything other than "Normal", then you can have them replace the Battery which is much less expensive than the cost to replace the Keyboard. The Battery is glued to the underside of the Palmrest & Trackpad and is part of the Top Case Assembly which also includes the Keyboard. If the Battery needs replaced, then make sure to avoid mention of any key issues since some techs may decide to focus on the key issue and replace the Keyboard instead which is a much more expensive repair even though the same exact part assembly is being replaced.
I would advise caution on whether it is worthwhile to spend any money on repairs and whether it may be better to put that money towards a new laptop. While the replacement butterfly keyboards seem to hold up better than the original from the factory, they still can have the manufacturing defect and small amounts of dirt & crumbs will still cause havoc with them.
If you have the non-touchbar model, then I would advise against spending any money on it since the SSDs in the non-touchbar model have a very high rate of failure. Plus the USB-C ports tend to wear down on them where the power cable & accessories may become easily detached or have intermittent connections. The USB-C ports are integrated onto the Logic Board of the non-touchbar model so it requires an expensive Logic Board replacement to fix loose ports.
The 2017 laptops are now considered "Vintage" so hardware support & repairs is limited. In fact macOS 13.x Ventura is the last supported OS for the 2017 laptop which will stop receiving security updates at the end of 2025.