I have similar global static methods within a global class that is annotated with @IsTest currently deployed in a managed package. They can be used by external applications for setting up test Opportunities. This makes it easier for installers to test classes that implement an interface that is also defined in the managed package.

If you want to ensure that the methods are only called from a unit test context you could start when with

System.assert(Test.isRunningTest(), 'XYZ() method can only be used in a testing context');

It won't help at compile time or during testing, but it will ensure the methods aren't used outside of tests.