Update Groovy Version within Jenkins Pipeline Template

Our devs have written the following templates and the team have found a bug with Jenkins Groovy Core 2.4.21 (the team completed an upgrade from Jenkins SandBox 2.303.1 Groovy Core 2.4.12 to Jenkins 2.387.1 Groovy Core 2.4.21 )

Im trying to investigate a quick and easy way to update Groovy without delaying the production upgrade

#!groovy
package pipelines.templates

pipeline {
    agent { label("maven-test-agent") }
    stages {
        stage("Setup workspace") {
            steps {
                script {
                    def workspace = load "src/modules/Workspace.groovy"
                    workspace.setup("resources/definitions/ecsDeployTemplate.yaml", false)
                }
            }
        }
       stage("Create ECS Build Deploy job") {
            steps {
                script {
                    log.heading("Create ECS Build Deploy job")
                    def jenkins = load "src/modules/Jenkins.groovy"
                    jenkins.createPipeline()
                }
            }
        }
    }
    post {
        always {
            script {
                def postAction = load "src/modules/PostAction.groovy"
                postAction.perform(false, true)
            }
        }
    }
}

Please correct me if I’m wrong but I need to rewrite these templates and move away from using script steps because if I set the following “withGroovy” this seems to be ignored and still triggers jenkins core groovy version 2.4.21

pipeline {
    agent { label("maven-test-image") }
    tools {
           groovy 'Groovy-2.5.1'
    }

or

 post {
        always {
            script {
                withGroovy(tool:'Groovy-2.5.1'){
                    def postAction = load "src/modules/PostAction.groovy"
                    data.athena.metadata["updated"] = false
                     postAction.perform(false)
                 }
            }
        }
    }

I was wondering if I should be completely rewriting the way the scripts are triggered within a pipeline job as an example

 stage ('Example') {
            steps {
                withGroovy(tool:'Groovy-2.5.1') {
                    sh 'groovy deploy.groovy'
                }
            }